diff options
| author | Kiran George <kirangeorge1995@gmail.com> | 2025-06-16 08:15:18 +0530 |
|---|---|---|
| committer | Kiran George <kirangeorge1995@gmail.com> | 2025-06-16 08:15:18 +0530 |
| commit | 1462996cc5256e6337eafc226423de5559214c7f (patch) | |
| tree | 3e24d5368222d0368348bb7aacd3ea7ce626622f | |
| parent | d46077fe5ac56afbd63dc1222e649f10435b05e2 (diff) | |
Expose font size and family in config
| -rw-r--r-- | config/quickshell/config.json | 24 | ||||
| -rw-r--r-- | config/quickshell/modules/common/ConfigOptions.qml | 1 | ||||
| -rw-r--r-- | config/quickshell/modules/overview/OverviewWidget.qml | 4 | ||||
| -rw-r--r-- | config/quickshell/services/ConfigLoader.qml | 39 |
4 files changed, 62 insertions, 6 deletions
diff --git a/config/quickshell/config.json b/config/quickshell/config.json index 33fca8e9..f6c9e843 100644 --- a/config/quickshell/config.json +++ b/config/quickshell/config.json @@ -15,7 +15,8 @@ "numOfCols": 5, "showXwaylandIndicator": true, "windowPadding": 6, - "position": 1 + "position": 1, + "workspaceNumberSize": 220 }, "resources": { "updateInterval": 3000 @@ -34,5 +35,26 @@ }, "bar": { "bottom": false + }, + "font": { + "family": { + "main": "Open Sans", + "title": "JetBrains Mono NF", + "iconMaterial": "FiraConde Nerd Font", + "iconNerd": "SpaceMono NF", + "monospace": "JetBrains Mono NF", + "reading": "Readex Pro" + }, + "pixelSize": { + "smallest": 10, + "smaller": 13, + "small": 15, + "normal": 16, + "large": 17, + "larger": 19, + "huge": 22, + "hugeass": 23, + "title": 28 + } } }
\ No newline at end of file diff --git a/config/quickshell/modules/common/ConfigOptions.qml b/config/quickshell/modules/common/ConfigOptions.qml index 61e6ab8e..25f0de05 100644 --- a/config/quickshell/modules/common/ConfigOptions.qml +++ b/config/quickshell/modules/common/ConfigOptions.qml @@ -16,6 +16,7 @@ Singleton { property bool showXwaylandIndicator: true property real windowPadding: 6 property real position: 1 // 0: top | 1: middle | 2: bottom + property real workspaceNumberSize: 120 // Set 0, dynamic calculation based on monitor size } property QtObject resources: QtObject { diff --git a/config/quickshell/modules/overview/OverviewWidget.qml b/config/quickshell/modules/overview/OverviewWidget.qml index 73dbbc26..63633602 100644 --- a/config/quickshell/modules/overview/OverviewWidget.qml +++ b/config/quickshell/modules/overview/OverviewWidget.qml @@ -35,7 +35,9 @@ Item { ((monitor.height - monitorData?.reserved[1] - monitorData?.reserved[3]) * root.scale / monitor.scale)) property real workspaceNumberMargin: 80 - property real workspaceNumberSize: Math.min(workspaceImplicitHeight, workspaceImplicitWidth) * monitor.scale + property real workspaceNumberSize: (ConfigOptions.overview.workspaceNumberSize > 0) + ? ConfigOptions.overview.workspaceNumberSize + : Math.min(workspaceImplicitHeight, workspaceImplicitWidth) * monitor.scale property int workspaceZ: 0 property int windowZ: 1 property int windowDraggingZ: 99999 diff --git a/config/quickshell/services/ConfigLoader.qml b/config/quickshell/services/ConfigLoader.qml index 051162d1..5f16bf55 100644 --- a/config/quickshell/services/ConfigLoader.qml +++ b/config/quickshell/services/ConfigLoader.qml @@ -29,7 +29,32 @@ Singleton { try { const json = JSON.parse(fileContent); - ObjectUtils.applyToQtObject(ConfigOptions, json); + // Extract font configuration if it exists + let fontConfig = null; + let configForOptions = {}; + + // Copy all properties except font to configForOptions + for (let key in json) { + if (key !== "font") { + configForOptions[key] = json[key]; + } else { + fontConfig = json[key]; + } + } + + // Apply the non-font configuration to ConfigOptions + ObjectUtils.applyToQtObject(ConfigOptions, configForOptions); + + // Apply font configuration to Appearance if it exists + if (fontConfig && typeof Appearance !== 'undefined') { + if (fontConfig.family && Appearance.font && Appearance.font.family) { + ObjectUtils.applyToQtObject(Appearance.font.family, fontConfig.family); + } + if (fontConfig.pixelSize && Appearance.font && Appearance.font.pixelSize) { + ObjectUtils.applyToQtObject(Appearance.font.pixelSize, fontConfig.pixelSize); + } + } + if (root.firstLoad) { root.firstLoad = false; } else { @@ -39,13 +64,19 @@ Singleton { console.error("[ConfigLoader] Error reading file:", e); Hyprland.dispatch(`exec notify-send "${qsTr("Shell configuration failed to load")}" "${root.filePath}"`) return; - } } function setLiveConfigValue(nestedKey, value) { let keys = nestedKey.split("."); - let obj = ConfigOptions; + let targetObject = ConfigOptions; + + // Check if this is a font-related configuration + if (keys[0] === "font" && typeof Appearance !== 'undefined') { + targetObject = Appearance; + } + + let obj = targetObject; let parents = [obj]; // Traverse and collect parent objects @@ -113,4 +144,4 @@ Singleton { } } } -} +}
\ No newline at end of file |
