From 5033bdc630608835f3d47c7d3fbe93d4fdb484a9 Mon Sep 17 00:00:00 2001 From: purian23 Date: Sat, 25 Apr 2026 15:29:27 -0400 Subject: [PATCH] (settings): Update monocrhrome & settings --- quickshell/Common/SettingsData.qml | 5 +- quickshell/Common/settings/SettingsSpec.js | 1 + .../Modules/DankBar/Widgets/SystemTrayBar.qml | 13 ++++++ quickshell/Modules/Settings/DankBarTab.qml | 46 ++++++++++--------- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index 6207d92e..edc6f412 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -194,6 +194,7 @@ Singleton { property int selectedGpuIndex: 0 property var enabledGpuPciIds: [] property bool showSystemTray: true + property bool systemTrayMonochromeIcons: false property bool showClock: true property bool showNotificationButton: true property bool showBattery: true @@ -1296,9 +1297,7 @@ Singleton { return true; const msg = String(error || "").toLowerCase(); - return msg.indexOf("file does not exist") !== -1 - || msg.indexOf("no such file") !== -1 - || msg.indexOf("enoent") !== -1; + return msg.indexOf("file does not exist") !== -1 || msg.indexOf("no such file") !== -1 || msg.indexOf("enoent") !== -1; } function loadPluginSettings() { diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index d3a9f0d0..01d43dda 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -69,6 +69,7 @@ var SPEC = { selectedGpuIndex: { def: 0 }, enabledGpuPciIds: { def: [] }, showSystemTray: { def: true }, + systemTrayMonochromeIcons: { def: false }, showClock: { def: true }, showNotificationButton: { def: true }, showBattery: { def: true }, diff --git a/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml b/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml index 2b728cd4..00b60ff9 100644 --- a/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml +++ b/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml @@ -79,6 +79,7 @@ BasePill { item: item })) readonly property var hiddenBarItems: allSortedTrayItems.filter(item => SessionData.isHiddenTrayId(root.getTrayItemKey(item))) + readonly property bool trayIconsMonochrome: SettingsData.systemTrayMonochromeIcons ?? false function moveTrayItemInFullOrder(visibleFromIndex, visibleToIndex) { if (visibleFromIndex === visibleToIndex || visibleFromIndex < 0 || visibleToIndex < 0) @@ -290,6 +291,10 @@ BasePill { smooth: true mipmap: true visible: status === Image.Ready + layer.enabled: root.trayIconsMonochrome && visible + layer.effect: MultiEffect { + saturation: -1 + } } Text { @@ -550,6 +555,10 @@ BasePill { smooth: true mipmap: true visible: status === Image.Ready + layer.enabled: root.trayIconsMonochrome && visible + layer.effect: MultiEffect { + saturation: -1 + } } Text { @@ -1067,6 +1076,10 @@ BasePill { smooth: true mipmap: true visible: status === Image.Ready + layer.enabled: root.trayIconsMonochrome && visible + layer.effect: MultiEffect { + saturation: -1 + } } Text { diff --git a/quickshell/Modules/Settings/DankBarTab.qml b/quickshell/Modules/Settings/DankBarTab.qml index 9511c844..f924edbd 100644 --- a/quickshell/Modules/Settings/DankBarTab.qml +++ b/quickshell/Modules/Settings/DankBarTab.qml @@ -52,9 +52,11 @@ Item { } function _isBarActive(c) { - if (!c.enabled) return false; + if (!c.enabled) + return false; const prefs = c.screenPreferences || ["all"]; - if (prefs.length > 0) return true; + if (prefs.length > 0) + return true; return (c.showOnLastDisplay ?? true) && Quickshell.screens.length === 1; } @@ -64,7 +66,8 @@ Item { return; const hasHorizontal = configs.some(c => { - if (!_isBarActive(c)) return false; + if (!_isBarActive(c)) + return false; const p = c.position ?? SettingsData.Position.Top; return p === SettingsData.Position.Top || p === SettingsData.Position.Bottom; }); @@ -72,7 +75,8 @@ Item { return; const hasVertical = configs.some(c => { - if (!_isBarActive(c)) return false; + if (!_isBarActive(c)) + return false; const p = c.position ?? SettingsData.Position.Top; return p === SettingsData.Position.Left || p === SettingsData.Position.Right; }); @@ -305,9 +309,7 @@ Item { const prefs = cfg?.screenPreferences || ["all"]; if (prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all")) return I18n.tr("All displays"); - return prefs.length === 1 - ? I18n.tr("%1 display").arg(prefs.length) - : I18n.tr("%1 displays").arg(prefs.length); + return prefs.length === 1 ? I18n.tr("%1 display").arg(prefs.length) : I18n.tr("%1 displays").arg(prefs.length); } font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText @@ -419,7 +421,7 @@ Item { iconName: "vertical_align_center" title: I18n.tr("Position") settingKey: "barPosition" - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false Item { width: parent.width @@ -479,7 +481,7 @@ Item { settingKey: "barDisplay" collapsible: true expanded: false - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false StyledText { width: parent.width @@ -586,7 +588,7 @@ Item { settingKey: "barVisibility" collapsible: true expanded: false - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false SettingsToggleRow { text: I18n.tr("Auto-hide") @@ -705,7 +707,7 @@ Item { iconName: "space_bar" title: I18n.tr("Spacing") settingKey: "barSpacing" - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false SettingsSliderRow { id: edgeSpacingSlider @@ -852,7 +854,7 @@ Item { iconName: "opacity" title: I18n.tr("Transparency") settingKey: "barTransparency" - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false SettingsSliderRow { id: barTransparencySlider @@ -904,7 +906,7 @@ Item { iconName: "text_fields" title: I18n.tr("Font Scale") description: I18n.tr("Scale DankBar font sizes independently") - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false minimum: 50 maximum: 200 value: Math.round((selectedBarConfig?.fontScale ?? 1.0) * 100) @@ -929,7 +931,7 @@ Item { iconName: "interests" title: I18n.tr("Icon Scale") description: I18n.tr("Scale DankBar icon sizes independently") - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false minimum: 50 maximum: 200 value: Math.round((selectedBarConfig?.iconScale ?? 1.0) * 100) @@ -955,7 +957,7 @@ Item { settingKey: "barCorners" collapsible: true expanded: false - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false SettingsToggleRow { text: I18n.tr("Square Corners") @@ -1055,7 +1057,7 @@ Item { iconName: "fit_screen" title: I18n.tr("Maximize Detection") description: I18n.tr("Remove gaps and border when windows are maximized") - visible: selectedBarConfig?.enabled && (CompositorService.isNiri || CompositorService.isHyprland) + visible: (selectedBarConfig?.enabled ?? false) && (CompositorService.isNiri || CompositorService.isHyprland) checked: selectedBarConfig?.maximizeDetection ?? true onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { maximizeDetection: checked @@ -1066,15 +1068,15 @@ Item { iconName: "filter_b_and_w" title: I18n.tr("Monochrome System Tray Icons") description: I18n.tr("Desaturate all system tray icons for a uniform monochrome look") - visible: selectedBarConfig?.enabled - checked: SettingsData.systemTrayMonochromeIcons + visible: selectedBarConfig?.enabled ?? false + checked: SettingsData.systemTrayMonochromeIcons ?? false onToggled: checked => SettingsData.set("systemTrayMonochromeIcons", checked) } SettingsToggleCard { iconName: "border_style" title: I18n.tr("Border") - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false checked: selectedBarConfig?.borderEnabled ?? false onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { borderEnabled: checked @@ -1164,7 +1166,7 @@ Item { SettingsToggleCard { iconName: "highlight" title: I18n.tr("Widget Outline") - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false checked: selectedBarConfig?.widgetOutlineEnabled ?? false onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { widgetOutlineEnabled: checked @@ -1258,7 +1260,7 @@ Item { settingKey: "barShadow" collapsible: true expanded: false - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false readonly property bool shadowActive: (selectedBarConfig?.shadowIntensity ?? 0) > 0 readonly property bool isCustomColor: (selectedBarConfig?.shadowColorMode ?? "text") === "custom" @@ -1383,7 +1385,7 @@ Item { iconName: "mouse" title: I18n.tr("Scroll Wheel") description: I18n.tr("Control workspaces and columns by scrolling on the bar") - visible: selectedBarConfig?.enabled + visible: selectedBarConfig?.enabled ?? false checked: selectedBarConfig?.scrollEnabled ?? true onToggled: checked => SettingsData.updateBarConfig(selectedBarId, { scrollEnabled: checked