aboutsummaryrefslogtreecommitdiffstats
path: root/shared
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 /shared
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 'shared')
-rw-r--r--shared/Workspaces.qml39
1 files changed, 39 insertions, 0 deletions
diff --git a/shared/Workspaces.qml b/shared/Workspaces.qml
new file mode 100644
index 0000000..ca4f5b0
--- /dev/null
+++ b/shared/Workspaces.qml
@@ -0,0 +1,39 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+pragma Singleton
+
+import Quickshell
+import QtQuick
+
+// The desktop icon for each workspace, the eight waybar drew and the window
+// switcher and the island show. Names, not paths: they are resolved through
+// the active icon theme, so an icon theme switch changes them everywhere.
+// A named workspace, or one past eight, has none, and callers fall back to
+// its number.
+Singleton {
+ readonly property var icons: ({
+ 1: "web-browser",
+ 2: "text-editor",
+ 3: "utilities-terminal",
+ 4: "network-server",
+ 5: "document-edit",
+ 6: "applications-graphics",
+ 7: "dialog-messages",
+ 8: "input-gaming",
+ })
+
+ function icon(name) {
+ const n = parseInt(String(name), 10);
+ if (isNaN(n)) return "";
+ return icons[n] ?? "";
+ }
+}