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/WindowCard.qml | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'window-switcher/WindowCard.qml') 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 + } } } -- cgit v1.2.3