Preview a workspace live when hovering it in the bar

The bar popout shows the hovered workspace as on its monitor: the
wallpaper and a live capture of each window where it sits. A click on it
switches there. The focused workspace is not previewed. Settings -> Bar
-> Preview on hover turns it off (bar.workspaces.preview).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-26 00:01:44 +01:00
1 parent 84c2385cfa
commit eb81d51c07
9 files changed
+231 -8

No files matched your search

+26 -1
View File
@@ -19,6 +19,10 @@ GlassPill {
// Workspaces shown on other monitors get a faint outline.
readonly property var visibleIds: Hyprland.monitors.values.map(m => m.activeWorkspace ? m.activeWorkspace.id : 0).filter(id => id > 0 && id !== activeId)
readonly property int count: ConfigService.data.bar.workspaces.count
// Hovering a workspace shows it live in the bar popout (off for copies,
// like the one in Settings).
property bool hoverPreview: true
readonly property bool previews: hoverPreview && ConfigService.data.bar.workspaces.preview !== false
readonly property string notchStyle: entry && entry.notch && ConfigService.data.notch ? ConfigService.data.notch.workspaceStyle : "bar"
readonly property string style: notchStyle && notchStyle !== "bar" ? notchStyle : ConfigService.data.bar.workspaces.style || "numbers"
readonly property bool textual: style === "numbers" || style === "roman" || style === "kanji"
@@ -205,12 +209,33 @@ GlassPill {
}
}
}
// The focused workspace is already on screen; the rest preview.
HoverHandler {
enabled: root.previews
onHoveredChanged: {
if (hovered)
PopoutState.hover(slot, slot.active ? "" : "workspace", "", slot.index + 1);
else
PopoutState.unhover(slot);
}
}
Connections {
target: slot
function onActiveChanged() {
if (slot.active && PopoutState.anchor === slot)
PopoutState.close();
}
}
MouseArea {
id: pelletArea
anchors.fill: parent
hoverEnabled: root.pacman
cursorShape: Qt.PointingHandCursor
onClicked: Hyprland.dispatch("hl.dsp.focus({ workspace = '" + (slot.index + 1) + "' })")
onClicked: {
if (PopoutState.anchor === slot)
PopoutState.close();
Hyprland.dispatch("hl.dsp.focus({ workspace = '" + (slot.index + 1) + "' })");
}
}
}
}