aboutsummaryrefslogtreecommitdiffstats
path: root/window-switcher/WindowCard.qml
diff options
context:
space:
mode:
Diffstat (limited to 'window-switcher/WindowCard.qml')
-rw-r--r--window-switcher/WindowCard.qml36
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
+ }
}
}