carousel for overiview
This commit is contained in:
1 parent
60afd11cda
commit
9031fae5e3
5 files changed
+77
-2
No files matched your search
@@ -41,7 +41,8 @@ split under `conf/` and pulled in with `require()`.
|
|||||||
`qs -c overview` daemon (autostarted in `conf/autostart.lua`), toggled over
|
`qs -c overview` daemon (autostarted in `conf/autostart.lua`), toggled over
|
||||||
Quickshell's IPC (`qs -c overview ipc call overview toggle`) from `Mod+Tab`
|
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`).
|
(`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.
|
`configs/fwbook/quickshell/ABOUTME.md` for the QML implementation.
|
||||||
|
|
||||||
## Files
|
## Files
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ plugin (Hyprland has none maintained against tagged releases — see
|
|||||||
to match the Hyprland `scrolling` layout's tape order.
|
to match the Hyprland `scrolling` layout's tape order.
|
||||||
- **Controls:** Arrow keys move the selection (Left/Right = window in the row,
|
- **Controls:** Arrow keys move the selection (Left/Right = window in the row,
|
||||||
Up/Down = workspace row), Enter focuses the selection and closes, Esc
|
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
|
- **Previews:** live via `Quickshell.Wayland.ScreencopyView`, capturing each
|
||||||
window's `HyprlandToplevel.wayland` handle. Capture only runs while the
|
window's `HyprlandToplevel.wayland` handle. Capture only runs while the
|
||||||
overview is visible (`live` is bound to the window's visibility).
|
overview is visible (`live` is bound to the window's visibility).
|
||||||
|
|||||||
@@ -104,6 +104,23 @@ PanelWindow {
|
|||||||
root.requestClose();
|
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: {
|
onVisibleChanged: {
|
||||||
if (root.visible) {
|
if (root.visible) {
|
||||||
Hyprland.refreshMonitors();
|
Hyprland.refreshMonitors();
|
||||||
@@ -137,6 +154,36 @@ PanelWindow {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: root.visible
|
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 => {
|
Keys.onPressed: event => {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_Left:
|
case Qt.Key_Left:
|
||||||
@@ -158,6 +205,20 @@ PanelWindow {
|
|||||||
case Qt.Key_Escape:
|
case Qt.Key_Escape:
|
||||||
root.requestClose();
|
root.requestClose();
|
||||||
break;
|
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:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -202,6 +263,11 @@ PanelWindow {
|
|||||||
root.selectedCol = colIndex;
|
root.selectedCol = colIndex;
|
||||||
root.activateSelection();
|
root.activateSelection();
|
||||||
}
|
}
|
||||||
|
onCardHovered: colIndex => {
|
||||||
|
if (!focusScope.shouldAcceptHover()) return;
|
||||||
|
root.selectedRow = index;
|
||||||
|
root.selectedCol = colIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ Rectangle {
|
|||||||
required property bool live
|
required property bool live
|
||||||
|
|
||||||
signal activated()
|
signal activated()
|
||||||
|
signal hovered()
|
||||||
|
|
||||||
readonly property var ipc: root.toplevel ? root.toplevel.lastIpcObject : null
|
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)
|
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 {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
onClicked: root.activated()
|
onClicked: root.activated()
|
||||||
|
onEntered: root.hovered()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ Item {
|
|||||||
required property bool live
|
required property bool live
|
||||||
|
|
||||||
signal cardClicked(int index)
|
signal cardClicked(int index)
|
||||||
|
signal cardHovered(int index)
|
||||||
|
|
||||||
// Slot cards are centered on when nothing in this row is selected (e.g.
|
// 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.
|
// it's not the active row), so an inactive row still reads as centered.
|
||||||
@@ -64,6 +65,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onActivated: root.cardClicked(index)
|
onActivated: root.cardClicked(index)
|
||||||
|
onHovered: root.cardHovered(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user