From 6d3747ec57db0bd23e6971dab2949381f3f195b5 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 16 Sep 2026 13:54:56 +0200 Subject: feat(window-switcher): mark desktops with waybar's icons The card's desktop line showed the workspace number. waybar draws the same eight desktops as CSS background images keyed by number, because its format-icons takes text rather than paths; those names now live in the Windows singleton and are resolved through the active icon theme, so a theme switch follows the drawer and the bar and the switcher agree. A named workspace, or one past eight, falls back to its number, and so does an icon the active theme cannot resolve. --- window-switcher/Windows.qml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'window-switcher/Windows.qml') diff --git a/window-switcher/Windows.qml b/window-switcher/Windows.qml index 040f4d4..fb582ad 100644 --- a/window-switcher/Windows.qml +++ b/window-switcher/Windows.qml @@ -64,4 +64,28 @@ Singleton { function closeWindow(toplevel) { 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: "utilities-terminal", + 3: "text-editor", + 4: "network-server", + 5: "document-edit", + 6: "applications-graphics", + 7: "internet-chat", + 8: "input-gaming", + }) + + function workspaceIcon(workspace) { + if (!workspace) return ""; + const n = parseInt(String(workspace.name), 10); + if (isNaN(n)) return ""; + return root.workspaceIcons[n] ?? ""; + } } -- cgit v1.2.3