From ab3fa11a4b0a5e2dc999d91d98269b3204f0aaa3 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 7 Oct 2026 18:47:14 +0200 Subject: 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 --- shared/Workspaces.qml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 shared/Workspaces.qml (limited to 'shared/Workspaces.qml') 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. +// +// 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] ?? ""; + } +} -- cgit v1.2.3