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/WindowCard.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/WindowCard.qml')
| -rw-r--r-- | window-switcher/WindowCard.qml | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/window-switcher/WindowCard.qml b/window-switcher/WindowCard.qml index de026e8..b86d69d 100644 --- a/window-switcher/WindowCard.qml +++ b/window-switcher/WindowCard.qml @@ -29,6 +29,14 @@ Column { // that is appearing or going away. Everything below guards for it. readonly property var wl: toplevel.wayland ?? null + // The bar's icon for this window's workspace, empty for a named workspace. + // Resolved to a path here so the card can fall back to the number when the + // active icon theme has no such icon, rather than showing a blank marker. + readonly property string workspaceIconPath: { + const name = Windows.workspaceIcon(toplevel.workspace); + return name !== "" ? Quickshell.iconPath(name, true) : ""; + } + width: cardWidth spacing: 8 @@ -125,12 +133,26 @@ Column { font.pixelSize: 13 } - Text { - width: parent.width - horizontalAlignment: Text.AlignHCenter - text: "[" + (card.toplevel.workspace ? card.toplevel.workspace.name : "?") + "]" - color: Theme.accent - font.family: Theme.fontFamily - font.pixelSize: 13 + // The desktop marker, drawn with waybar's workspace icon rather than the + // number. A workspace with no icon keeps the number, so the line never + // goes blank. + Item { + width: card.width + height: 24 + + IconImage { + anchors.centerIn: parent + width: 22; height: 22 + source: card.workspaceIconPath + } + + Text { + anchors.centerIn: parent + visible: card.workspaceIconPath === "" + text: "[" + (card.toplevel.workspace ? card.toplevel.workspace.name : "?") + "]" + color: Theme.accent + font.family: Theme.fontFamily + font.pixelSize: 13 + } } } |
