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:
1 parent
84c2385cfa
commit
eb81d51c07
9 files changed
+231
-8
No files matched your search
@@ -5,6 +5,8 @@ import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import "../components"
|
||||
import "../core"
|
||||
import "../overview"
|
||||
import "../services"
|
||||
import "../theme"
|
||||
// Bar hover popout. HyprGlass shapes glass from the layer box, so the surface is
|
||||
// sized to the card and its geometry animates to morph between anchors.
|
||||
@@ -16,7 +18,7 @@ PanelWindow {
|
||||
readonly property var anchorWindow: anchorItem ? anchorItem.QsWindow.window : null
|
||||
readonly property string kind: PopoutState.kind
|
||||
// The hovered window's Wayland toplevel; falls back to the focused one.
|
||||
readonly property var toplevel: PopoutState.payload || ToplevelManager.activeToplevel
|
||||
readonly property var toplevel: kind === "window" ? PopoutState.payload || ToplevelManager.activeToplevel : null
|
||||
// Anchors may name a wider placement item (the tray pill, the window list)
|
||||
// so the drawer stays put while the pointer moves between its entries.
|
||||
readonly property var anchorObject: anchorItem
|
||||
@@ -26,8 +28,9 @@ PanelWindow {
|
||||
readonly property point windowPoint: placementItem && anchorWindow ? placementItem.mapToItem(anchorWindow.contentItem, 0, 0) : Qt.point(0, 0)
|
||||
readonly property point anchorPoint: Qt.point(windowPoint.x + windowOffsetX, windowPoint.y)
|
||||
readonly property real availableWidth: screen ? screen.width : 1280
|
||||
readonly property real targetWidth: Math.ceil(root.kind === "window" ? windowCard.implicitWidth : tip.implicitWidth)
|
||||
readonly property real targetHeight: Math.ceil(root.kind === "window" ? windowCard.implicitHeight : tip.implicitHeight)
|
||||
readonly property Item card: kind === "window" ? windowCard : kind === "workspace" ? workspaceCard : tip
|
||||
readonly property real targetWidth: Math.ceil(card.implicitWidth)
|
||||
readonly property real targetHeight: Math.ceil(card.implicitHeight)
|
||||
readonly property real targetX: BarDrawers.clampX(anchorPoint.x + (placementItem ? placementItem.width / 2 : 0), targetWidth + 2 * BarDrawers.ear, availableWidth)
|
||||
// Morph only while the drawer is out; a cold open grows in place.
|
||||
readonly property bool morph: drawer.progress > 0.05 && Theme.duration > 0
|
||||
@@ -111,6 +114,26 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
// A hovered workspace in the bar, live.
|
||||
WorkspacePreview {
|
||||
id: workspaceCard
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
workspaceId: root.kind === "workspace" ? PopoutState.payload || 0 : 0
|
||||
live: root.active && root.kind === "workspace"
|
||||
opacity: root.kind === "workspace" ? 1 : 0
|
||||
visible: opacity > 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
onChosen: {
|
||||
const id = workspaceId;
|
||||
PopoutState.close();
|
||||
HyprlandService.focusWorkspace(id);
|
||||
}
|
||||
}
|
||||
Column {
|
||||
id: windowCard
|
||||
objectName: "windowPreview"
|
||||
|
||||
Reference in new issue
Block a user