From 9031fae5e3dabfb9ef7a3b4b5a9350cb76602b6e Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Mon, 31 Aug 2026 14:02:42 -0400 Subject: [PATCH] carousel for overiview --- configs/fwbook/hypr/ABOUTME.md | 3 +- configs/fwbook/quickshell/ABOUTME.md | 5 +- .../quickshell/overview/OverviewWindow.qml | 66 +++++++++++++++++++ .../fwbook/quickshell/overview/WindowCard.qml | 3 + .../quickshell/overview/WorkspaceRow.qml | 2 + 5 files changed, 77 insertions(+), 2 deletions(-) diff --git a/configs/fwbook/hypr/ABOUTME.md b/configs/fwbook/hypr/ABOUTME.md index 2d67c61..7864df0 100644 --- a/configs/fwbook/hypr/ABOUTME.md +++ b/configs/fwbook/hypr/ABOUTME.md @@ -41,7 +41,8 @@ split under `conf/` and pulled in with `require()`. `qs -c overview` daemon (autostarted in `conf/autostart.lua`), toggled over Quickshell's IPC (`qs -c overview ipc call overview toggle`) from `Mod+Tab` (`conf/keybindings.lua`) and a 4-finger swipe up/down (`conf/inputs.lua`). - Arrow keys move the selection, Enter focuses + closes, Esc cancels. See + Arrow keys move the selection, Enter focuses + closes, Esc cancels, `M` + cycles to the next monitor, 1-9 jump straight to a monitor by index. See `configs/fwbook/quickshell/ABOUTME.md` for the QML implementation. ## Files diff --git a/configs/fwbook/quickshell/ABOUTME.md b/configs/fwbook/quickshell/ABOUTME.md index 1ae91c3..6aea9a9 100644 --- a/configs/fwbook/quickshell/ABOUTME.md +++ b/configs/fwbook/quickshell/ABOUTME.md @@ -20,7 +20,10 @@ plugin (Hyprland has none maintained against tagged releases — see to match the Hyprland `scrolling` layout's tape order. - **Controls:** Arrow keys move the selection (Left/Right = window in the row, Up/Down = workspace row), Enter focuses the selection and closes, Esc - cancels. No mouse-driven drag/resize. + cancels, `M` cycles to the next monitor's overview, number keys 1-9 jump + straight to the Nth monitor (sorted by Hyprland's monitor id). Hovering a + window card also recenters the carousel on it (selection-only, doesn't + focus/close). No drag/resize. - **Previews:** live via `Quickshell.Wayland.ScreencopyView`, capturing each window's `HyprlandToplevel.wayland` handle. Capture only runs while the overview is visible (`live` is bound to the window's visibility). diff --git a/configs/fwbook/quickshell/overview/OverviewWindow.qml b/configs/fwbook/quickshell/overview/OverviewWindow.qml index f27a898..d43800e 100644 --- a/configs/fwbook/quickshell/overview/OverviewWindow.qml +++ b/configs/fwbook/quickshell/overview/OverviewWindow.qml @@ -104,6 +104,23 @@ PanelWindow { root.requestClose(); } + // Switches Hyprland's focused monitor; the overview stays open since + // `shellOpen` is shared across all monitors' OverviewWindow instances — + // this one's `monitorFocused` goes false as the next monitor's goes true, + // so the overlay hands off to that monitor's own instance. + function cycleMonitor() { + Quickshell.execDetached(["hyprctl", "dispatch", `hl.dsp.focus({monitor = "+1"})`]); + } + + readonly property var sortedMonitors: Hyprland.monitors ? Hyprland.monitors.values.slice().sort((a, b) => a.id - b.id) : [] + + // Jump straight to the Nth monitor (0-based), bound to number keys 1-9. + function focusMonitorByIndex(i) { + const mon = root.sortedMonitors[i]; + if (!mon) return; + Quickshell.execDetached(["hyprctl", "dispatch", `hl.dsp.focus({monitor = "${mon.name}"})`]); + } + onVisibleChanged: { if (root.visible) { Hyprland.refreshMonitors(); @@ -137,6 +154,36 @@ PanelWindow { anchors.fill: parent focus: root.visible + // Hovering a card recenters the carousel, which can slide a + // different card under an otherwise-stationary cursor and retrigger + // hover on it ("combo hover"). A pure movement-distance check isn't + // enough — ordinary mouse/trackpad jitter (a few px) clears a small + // threshold on its own. So: hard-lock all hover triggers for the + // duration of the recentering animation (nothing can retrigger while + // cards are still sliding), and additionally require the cursor to + // have moved well past jitter range since the last accepted trigger. + HoverHandler { + id: mouseTracker + } + property point lastHoverAcceptPos: Qt.point(-1, -1) + property bool hoverLocked: false + Timer { + id: hoverLockTimer + interval: root.theme.carouselDuration + onTriggered: focusScope.hoverLocked = false + } + function shouldAcceptHover() { + if (focusScope.hoverLocked) return false; + const cur = mouseTracker.point.position; + const dx = cur.x - focusScope.lastHoverAcceptPos.x; + const dy = cur.y - focusScope.lastHoverAcceptPos.y; + if ((dx * dx + dy * dy) <= 1600) return false; // 40px + focusScope.lastHoverAcceptPos = cur; + focusScope.hoverLocked = true; + hoverLockTimer.restart(); + return true; + } + Keys.onPressed: event => { switch (event.key) { case Qt.Key_Left: @@ -158,6 +205,20 @@ PanelWindow { case Qt.Key_Escape: root.requestClose(); break; + case Qt.Key_M: + root.cycleMonitor(); + break; + case Qt.Key_1: + case Qt.Key_2: + case Qt.Key_3: + case Qt.Key_4: + case Qt.Key_5: + case Qt.Key_6: + case Qt.Key_7: + case Qt.Key_8: + case Qt.Key_9: + root.focusMonitorByIndex(event.key - Qt.Key_1); + break; default: return; } @@ -202,6 +263,11 @@ PanelWindow { root.selectedCol = colIndex; root.activateSelection(); } + onCardHovered: colIndex => { + if (!focusScope.shouldAcceptHover()) return; + root.selectedRow = index; + root.selectedCol = colIndex; + } } } } diff --git a/configs/fwbook/quickshell/overview/WindowCard.qml b/configs/fwbook/quickshell/overview/WindowCard.qml index d3b5b68..943f56a 100644 --- a/configs/fwbook/quickshell/overview/WindowCard.qml +++ b/configs/fwbook/quickshell/overview/WindowCard.qml @@ -11,6 +11,7 @@ Rectangle { required property bool live signal activated() + signal hovered() readonly property var ipc: root.toplevel ? root.toplevel.lastIpcObject : null readonly property real aspect: (ipc && ipc.size && ipc.size[0] > 0 && ipc.size[1] > 0) ? ipc.size[0] / ipc.size[1] : (16 / 9) @@ -64,6 +65,8 @@ Rectangle { MouseArea { anchors.fill: parent + hoverEnabled: true onClicked: root.activated() + onEntered: root.hovered() } } diff --git a/configs/fwbook/quickshell/overview/WorkspaceRow.qml b/configs/fwbook/quickshell/overview/WorkspaceRow.qml index 937a014..e355996 100644 --- a/configs/fwbook/quickshell/overview/WorkspaceRow.qml +++ b/configs/fwbook/quickshell/overview/WorkspaceRow.qml @@ -10,6 +10,7 @@ Item { required property bool live signal cardClicked(int index) + signal cardHovered(int index) // Slot cards are centered on when nothing in this row is selected (e.g. // it's not the active row), so an inactive row still reads as centered. @@ -64,6 +65,7 @@ Item { } onActivated: root.cardClicked(index) + onHovered: root.cardHovered(index) } }