aboutsummaryrefslogtreecommitdiffstats
path: root/window-switcher/Windows.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-07 18:47:14 +0200
committerDanilo M. <danix@danix.xyz>2026-10-07 18:47:40 +0200
commitab3fa11a4b0a5e2dc999d91d98269b3204f0aaa3 (patch)
tree2530173fff5e2db8978e16c6d367da7e4a90e0c0 /window-switcher/Windows.qml
parent3ad0c126ff287cc66b8532196a897d65d114b4a8 (diff)
downloadquickshell-ab3fa11a4b0a5e2dc999d91d98269b3204f0aaa3.tar.gz
quickshell-ab3fa11a4b0a5e2dc999d91d98269b3204f0aaa3.zip
refactor: move the workspace icon map to a shared singleton
The island's clock pill shows the same desktop icon the window switcher does. One map, symlinked into both components like Theme.qml, rather than a second copy that would drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'window-switcher/Windows.qml')
-rw-r--r--window-switcher/Windows.qml24
1 files changed, 3 insertions, 21 deletions
diff --git a/window-switcher/Windows.qml b/window-switcher/Windows.qml
index ec86ee5..bfd176a 100644
--- a/window-switcher/Windows.qml
+++ b/window-switcher/Windows.qml
@@ -65,27 +65,9 @@ Singleton {
Hyprland.dispatch(`hl.dsp.window.close({ window = "address:${addressOf(toplevel)}" })`);
}
- // The desktop marker on a card is the same icon waybar's bar draws for that
- // workspace, so the switcher and the bar agree. waybar keeps them as CSS
- // background images by workspace number (styles/modules.css); the names are
- // repeated here and resolved through the active icon theme, because a
- // QML-side icon has to go by name. A named workspace, or one past eight,
- // has no icon and the card falls back to its number.
- readonly property var workspaceIcons: ({
- 1: "web-browser",
- 2: "text-editor",
- 3: "utilities-terminal",
- 4: "network-server",
- 5: "document-edit",
- 6: "applications-graphics",
- 7: "dialog-messages",
- 8: "input-gaming",
- })
-
+ // The desktop marker on a card is the same icon the island and the old
+ // waybar bar show for that workspace; the map lives in Workspaces.qml.
function workspaceIcon(workspace) {
- if (!workspace) return "";
- const n = parseInt(String(workspace.name), 10);
- if (isNaN(n)) return "";
- return root.workspaceIcons[n] ?? "";
+ return workspace ? Workspaces.icon(workspace.name) : "";
}
}