diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index e1dc3377..556104f6 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -206,6 +206,7 @@ Singleton { property bool reverseScrolling: false property bool dwlShowAllTags: false property string workspaceColorMode: "default" + property string workspaceOccupiedColorMode: "default" property string workspaceUnfocusedColorMode: "default" property string workspaceUrgentColorMode: "default" property bool workspaceFocusedBorderEnabled: false diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index 664e1227..db87a6a6 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -100,6 +100,7 @@ var SPEC = { reverseScrolling: { def: false }, dwlShowAllTags: { def: false }, workspaceColorMode: { def: "default" }, + workspaceOccupiedColorMode: { def: "default" }, workspaceUnfocusedColorMode: { def: "default" }, workspaceUrgentColorMode: { def: "default" }, workspaceFocusedBorderEnabled: { def: false }, diff --git a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml index e70297c1..0fc85541 100644 --- a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml +++ b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml @@ -754,6 +754,16 @@ Item { return !!(modelData && modelData.num === root.currentWorkspace); return modelData === root.currentWorkspace; } + property bool isOccupied: { + if (CompositorService.isHyprland) + return Array.from(Hyprland.toplevels?.values || []) + .some(tl => tl.workspace?.id === modelData?.id); + if (CompositorService.isDwl) + return modelData.clients > 0; + if (CompositorService.isNiri) + return NiriService.windows?.some(win => win.workspace_id === modelData?.id) ?? false; + return false; + } property bool isPlaceholder: { if (root.useExtWorkspace) return !!(modelData && modelData.hidden); @@ -835,6 +845,21 @@ Item { } } + readonly property color occupiedColor: { + switch (SettingsData.workspaceOccupiedColorMode) { + case "s": + return Theme.surface; + case "sc": + return Theme.surfaceContainer; + case "sch": + return Theme.surfaceContainerHigh; + case "none": + return unfocusedColor; + default: + return Theme.secondary; + } + } + readonly property color urgentColor: { switch (SettingsData.workspaceUrgentColorMode) { case "primary": @@ -1022,7 +1047,7 @@ Item { height: delegateRoot.visualHeight anchors.centerIn: parent radius: Theme.cornerRadius - color: isActive ? activeColor : isUrgent ? urgentColor : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.withAlpha(unfocusedColor, 0.7) : unfocusedColor + color: isActive ? activeColor : isUrgent ? urgentColor : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.withAlpha(unfocusedColor, 0.7) : isOccupied ? occupiedColor : unfocusedColor border.width: isUrgent ? 2 : 0 border.color: isUrgent ? urgentColor : "transparent" diff --git a/quickshell/Modules/Settings/WorkspacesTab.qml b/quickshell/Modules/Settings/WorkspacesTab.qml index c57e4b5b..182aadc2c 100644 --- a/quickshell/Modules/Settings/WorkspacesTab.qml +++ b/quickshell/Modules/Settings/WorkspacesTab.qml @@ -199,6 +199,46 @@ Item { opacity: 0.15 } + SettingsButtonGroupRow { + text: I18n.tr("Occupied Color") + model: ["sec", "s", "sc", "sch", "none"] + visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl + buttonHeight: 22 + minButtonWidth: 36 + buttonPadding: Theme.spacingS + checkIconSize: Theme.iconSizeSmall - 2 + textSize: Theme.fontSizeSmall - 1 + spacing: 1 + currentIndex: { + switch (SettingsData.wokspaceColorMode) { + case "s": + return 1; + case "sc": + return 2; + case "sch": + return 3; + case "none": + return 4; + default: + return 0; + } + } + onSelectionChanged: (index, selected) => { + if (!selected) + return; + const modes = ["default", "s", "sc", "sch", "none"]; + SettingsData.set("workspaceOccupiedColorMode", modes[index]); + } + } + + Rectangle { + width: parent.width + height: 1 + color: Theme.outline + opacity: 0.15 + visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl + } + SettingsButtonGroupRow { text: I18n.tr("Unfocused Color") model: ["def", "s", "sc", "sch"]