diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 13:54:56 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 13:54:56 +0200 |
| commit | 6d3747ec57db0bd23e6971dab2949381f3f195b5 (patch) | |
| tree | a6bd484db9253d56bbdad2d1e4ca700e4deffa25 /window-switcher/Windows.qml | |
| parent | 516e44c6c87825bfc985cbe6a1e73fce3fa7762a (diff) | |
| download | quickshell-6d3747ec57db0bd23e6971dab2949381f3f195b5.tar.gz quickshell-6d3747ec57db0bd23e6971dab2949381f3f195b5.zip | |
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.
Diffstat (limited to 'window-switcher/Windows.qml')
| -rw-r--r-- | window-switcher/Windows.qml | 24 |
1 files changed, 24 insertions, 0 deletions
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] ?? ""; + } } |
