1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

add option to change occupied workspace color (#1427)

This commit is contained in:
Eggrror404
2026-01-19 02:25:37 +08:00
committed by GitHub
parent a685d9da52
commit 1adbf3937b
4 changed files with 68 additions and 1 deletions

View File

@@ -206,6 +206,7 @@ Singleton {
property bool reverseScrolling: false property bool reverseScrolling: false
property bool dwlShowAllTags: false property bool dwlShowAllTags: false
property string workspaceColorMode: "default" property string workspaceColorMode: "default"
property string workspaceOccupiedColorMode: "default"
property string workspaceUnfocusedColorMode: "default" property string workspaceUnfocusedColorMode: "default"
property string workspaceUrgentColorMode: "default" property string workspaceUrgentColorMode: "default"
property bool workspaceFocusedBorderEnabled: false property bool workspaceFocusedBorderEnabled: false

View File

@@ -100,6 +100,7 @@ var SPEC = {
reverseScrolling: { def: false }, reverseScrolling: { def: false },
dwlShowAllTags: { def: false }, dwlShowAllTags: { def: false },
workspaceColorMode: { def: "default" }, workspaceColorMode: { def: "default" },
workspaceOccupiedColorMode: { def: "default" },
workspaceUnfocusedColorMode: { def: "default" }, workspaceUnfocusedColorMode: { def: "default" },
workspaceUrgentColorMode: { def: "default" }, workspaceUrgentColorMode: { def: "default" },
workspaceFocusedBorderEnabled: { def: false }, workspaceFocusedBorderEnabled: { def: false },

View File

@@ -754,6 +754,16 @@ Item {
return !!(modelData && modelData.num === root.currentWorkspace); return !!(modelData && modelData.num === root.currentWorkspace);
return modelData === 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: { property bool isPlaceholder: {
if (root.useExtWorkspace) if (root.useExtWorkspace)
return !!(modelData && modelData.hidden); 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: { readonly property color urgentColor: {
switch (SettingsData.workspaceUrgentColorMode) { switch (SettingsData.workspaceUrgentColorMode) {
case "primary": case "primary":
@@ -1022,7 +1047,7 @@ Item {
height: delegateRoot.visualHeight height: delegateRoot.visualHeight
anchors.centerIn: parent anchors.centerIn: parent
radius: Theme.cornerRadius 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.width: isUrgent ? 2 : 0
border.color: isUrgent ? urgentColor : "transparent" border.color: isUrgent ? urgentColor : "transparent"

View File

@@ -199,6 +199,46 @@ Item {
opacity: 0.15 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 { SettingsButtonGroupRow {
text: I18n.tr("Unfocused Color") text: I18n.tr("Unfocused Color")
model: ["def", "s", "sc", "sch"] model: ["def", "s", "sc", "sch"]