carousel for overiview

This commit is contained in:
ari committed 2026-08-31 14:13:18 -04:00
1 parent 9031fae5e3
commit 765ddd8525
7 files changed
+169 -42

No files matched your search

+5 -1
View File
@@ -74,7 +74,11 @@ hypr/
- `Mod+Shift+H` (show-hotkey-overlay) — no native Hyprland equivalent; left commented.
- `Mod+Escape` (toggle-keyboard-shortcuts-inhibit) — no native equivalent; omitted.
- `Mod+W` (toggle-column-tabbed-display) — mapped to `hl.dsp.group.toggle()` as the nearest analog.
- `Mod+W` (toggle-column-tabbed-display) — mapped to `hl.dsp.group.toggle()` as the nearest
analog. Additional group binds were added on top: `Mod+Shift+W` (merge into an adjacent
group), `Mod+Alt+W` (pull out of a group), `Mod+Shift+Left/Right` (cycle through the
active group's tabs; no-op outside a group, so they share keys with `playerctl`), and
`Mod+Shift+G` (lock/unlock the group).
- `Mod+Tab` (toggle-overview) — the Quickshell scrolling overview (see above);
previously a pure-Lua wofi picker, then the ScrollOverview plugin, and
`cyclenext` before that.
+9
View File
@@ -49,6 +49,15 @@ hl.bind(mod .. " + CTRL + down", hl.dsp.window.move({ workspace = "r+1", follow
-- niri: toggle-column-tabbed-display (closest: group/tab windows together)
hl.bind(mod .. " + W", hl.dsp.group.toggle())
-- niri: (no feat.) group the focused window into the neighbour's tab group
hl.bind(mod .. " + SHIFT + W", hl.dsp.group.move({ direction = "l", mode = "into" }))
-- niri: (no feat.) pull the focused window out of its group back to a tile
hl.bind(mod .. " + ALT + W", hl.dsp.group.move({ direction = "l", mode = "outof" }))
-- niri: (no feat.) cycle through the active group's tabs (no-op outside a group)
hl.bind(mod .. " + SHIFT + left", hl.dsp.group.activate("b"))
hl.bind(mod .. " + SHIFT + right", hl.dsp.group.activate("f"))
-- niri: (no feat.) lock/unlock the group so its tabs can't be rearranged
hl.bind(mod .. " + SHIFT + G", hl.dsp.group.lock())
-- niri: maximize-column -> cycle through preset column widths (colresize +conf)`
hl.bind(mod .. " + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" }))
-- hl.bind(mod .. " + F", hl.dsp.layout("colresize +conf"))
+19
View File
@@ -111,10 +111,29 @@ function dsp_window.drag() end
---@class hl.dsp.group
local dsp_group = {}
---@class hl.dsp.GroupMoveOpts
---@field direction "l"|"r" Merge into / pull out of the group on this side
---@field mode? "into"|"outof" Defaults to "into"
---Toggle the focused window's group/tab mode.
---@return hl.DispatcherValue
function dsp_group.toggle() end
---Merge the focused window into an adjacent group ("into") or pull it out
---back to a normal tile ("outof").
---@param opts hl.dsp.GroupMoveOpts
---@return hl.DispatcherValue
function dsp_group.move(opts) end
---Cycle focus through the members of the active group's tab bar.
---@param dir "b"|"f" b = back, f = forward
---@return hl.DispatcherValue
function dsp_group.activate(dir) end
---Lock/unlock the focused group so its tabs can't be rearranged.
---@return hl.DispatcherValue
function dsp_group.lock() end
---@class hl.dsp.workspace
local dsp_workspace = {}
+34 -16
View File
@@ -15,37 +15,55 @@ A niri-like scrolling overview for Hyprland, standing in for a native overview
plugin (Hyprland has none maintained against tagged releases — see
`modules/nixos/desktop/tiler/ABOUTME.md`).
- **Model:** the current monitor's workspaces are vertical rows, each row a
- **Model:** the browsed monitor's workspaces are vertical rows, each row a
horizontal strip of that workspace's windows (columns), sorted by x-position
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, `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
straight to the Nth monitor (sorted by Hyprland's monitor id) — also
clickable via the monitor bar at the top of the screen. Hovering a window
card also recenters the carousel on it (selection-only, doesn't
focus/close). No drag/resize.
- **Monitor browsing vs. real focus:** a single overlay window, anchored once
(per open) to whichever monitor was actually focused when the overview
opened, and never moved after that. Switching monitors while browsing (M /
number keys / the monitor bar) only updates local UI state
(`shell.browsedMonitor` in `shell.qml`) that changes which monitor's
workspace data this one fixed window displays — it never touches Hyprland's
real focused monitor. This isn't just a style choice: a `PanelWindow`'s
`HyprlandFocusGrab` requires Hyprland's real seat focus to follow the
window that holds it, so a one-overlay-per-screen design (switching which
screen's overlay is visible) would force a real focus/cursor jump to
whichever monitor you browsed to, every time. Only activating a window or
workspace (Enter/click) dispatches a real Hyprland focus change.
- **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).
- **Focus dispatch:** classic `hyprctl`-style dispatcher strings
(`"workspace " + id`, `"focuswindow address:" + addr`) via
`Hyprland.dispatch(...)` — these work regardless of whether Hyprland's
config is Lua or hyprlang, unlike the Lua-eval dispatch form.
- **Focus dispatch:** this Hyprland build's `hyprctl dispatch <name> <args>`
no longer accepts classic freeform dispatch text at all — every request is
evaluated as Lua (`hl.dispatch(<text>)`), so the text must already be a
valid `hl.dsp.*` call. Verified forms: `hl.dsp.focus({workspace = N})`,
`hl.dsp.focus({window = "address:0x..."})`, `hl.dsp.focus({monitor = "name"})`
— sent via `Quickshell.execDetached(["hyprctl", "dispatch", ...])` since
`Hyprland.dispatch()` hits the exact same broken classic-syntax path.
### Files
```
overview/
├── shell.qml # ShellRoot: IpcHandler (target "overview": toggle/open/close)
│ # + Variants { model: Quickshell.screens } instantiating one
│ # OverviewWindow per monitor
├── OverviewWindow.qml # per-monitor PanelWindow (layer-shell overlay); builds the
│ # workspace/window model from Quickshell.Hyprland, owns
│ # selection state, key handling, and HyprlandFocusGrab
├── WorkspaceRow.qml # one workspace = horizontal Row of WindowCards + label
├── shell.qml # ShellRoot: IpcHandler (target "overview": toggle/open/close),
│ # sets browsedMonitor + anchorScreen on open, owns the single
│ # OverviewWindow instance
├── OverviewWindow.qml # the one PanelWindow (layer-shell overlay), anchored to
│ # anchorScreen for the whole open session; builds the browsed
│ # monitor's workspace/window model from Quickshell.Hyprland,
│ # owns selection state, key handling, and HyprlandFocusGrab
├── MonitorBar.qml # row of clickable per-monitor pills, highlights browsedMonitor
├── WorkspaceRow.qml # one workspace = carousel Row of WindowCards + label
├── WindowCard.qml # live ScreencopyView preview + icon/title footer + selection ring
└── Theme.qml # plain QtObject with colors/sizes, instantiated once per
# OverviewWindow and prop-drilled down (no singleton/qmldir)
└── Theme.qml # plain QtObject with colors/sizes/carousel tuning, instantiated
# once per OverviewWindow and prop-drilled down (no singleton/qmldir)
```
`Theme.qml` and the other sibling `.qml` files are used without explicit
@@ -0,0 +1,47 @@
import QtQuick
Row {
id: root
required property var theme
required property var monitors
required property string focusedMonitorName
signal monitorClicked(int index)
spacing: theme.cardSpacing * 0.5
visible: monitors.length > 1
Repeater {
model: root.monitors
Rectangle {
id: pill
required property var modelData
required property int index
readonly property bool active: modelData.name === root.focusedMonitorName
width: label.implicitWidth + 24
height: 32
radius: height / 2
color: pill.active ? root.theme.selectedBorder : root.theme.cardBg
border.width: 1
border.color: root.theme.cardBorder
Text {
id: label
anchors.centerIn: parent
text: (pill.index + 1) + ": " + pill.modelData.name
color: root.theme.textColor
font.pixelSize: 12
font.bold: pill.active
}
MouseArea {
anchors.fill: parent
onClicked: root.monitorClicked(pill.index)
}
}
}
}
@@ -7,11 +7,11 @@ PanelWindow {
id: root
required property bool shellOpen
required property string browsedMonitor
signal requestClose()
signal requestBrowseMonitor(string name)
readonly property var monitor: Hyprland.monitorFor(root.screen)
readonly property bool monitorFocused: monitor && Hyprland.focusedMonitor && monitor.id === Hyprland.focusedMonitor.id
visible: root.shellOpen && root.monitorFocused
visible: root.shellOpen
color: "transparent"
@@ -40,13 +40,12 @@ PanelWindow {
});
}
// Workspace rows for this monitor, top-to-bottom by workspace id. Special
// (scratchpad) workspaces have negative ids and are excluded.
// Workspace rows for the browsed monitor, top-to-bottom by workspace id.
// Special (scratchpad) workspaces have negative ids and are excluded.
readonly property var rows: {
const mon = root.monitor;
if (!mon || !Hyprland.workspaces) return [];
if (!root.browsedMonitor || !Hyprland.workspaces) return [];
const workspaces = Hyprland.workspaces.values
.filter(ws => ws && ws.id > 0 && ws.monitor && ws.monitor.name === mon.name)
.filter(ws => ws && ws.id > 0 && ws.monitor && ws.monitor.name === root.browsedMonitor)
.sort((a, b) => a.id - b.id);
return workspaces.map(ws => ({ workspace: ws, toplevels: root.sortedToplevels(ws) }));
}
@@ -104,21 +103,24 @@ 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.
// Advances which monitor's overview is being browsed (see shell.qml) —
// purely local UI state, doesn't touch Hyprland's real focused monitor.
function cycleMonitor() {
Quickshell.execDetached(["hyprctl", "dispatch", `hl.dsp.focus({monitor = "+1"})`]);
const mons = root.sortedMonitors;
if (mons.length === 0) return;
const curIdx = Math.max(0, mons.findIndex(m => m.name === root.browsedMonitor));
const mon = mons[(curIdx + 1) % mons.length];
root.requestBrowseMonitor(mon.name);
}
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.
// Jump straight to the Nth monitor's overview (0-based), bound to number
// keys 1-9 and the monitor bar.
function focusMonitorByIndex(i) {
const mon = root.sortedMonitors[i];
if (!mon) return;
Quickshell.execDetached(["hyprctl", "dispatch", `hl.dsp.focus({monitor = "${mon.name}"})`]);
root.requestBrowseMonitor(mon.name);
}
onVisibleChanged: {
@@ -225,6 +227,16 @@ PanelWindow {
event.accepted = true;
}
MonitorBar {
anchors.top: parent.top
anchors.topMargin: 24
anchors.horizontalCenter: parent.horizontalCenter
theme: root.theme
monitors: root.sortedMonitors
focusedMonitorName: root.browsedMonitor
onMonitorClicked: index => root.focusMonitorByIndex(index)
}
Item {
anchors.fill: parent
+28 -10
View File
@@ -1,14 +1,35 @@
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
// Scrolling overview for Hyprland — vertical stack of workspace rows on the
// current monitor, each row a horizontal strip of that workspace's windows.
// browsed monitor, each row a horizontal strip of that workspace's windows.
// Toggle with `qs -c overview ipc call overview <toggle|open|close>`; wired
// to Mod+Tab and a 4-finger swipe in the Hyprland config.
//
// Deliberately a single window, anchored once (per open) to whichever
// monitor was actually focused when the overview opened, and never moved
// after that — a PanelWindow's HyprlandFocusGrab requires Hyprland's real
// seat focus to follow it, so a per-monitor-window design (one overlay per
// screen, switching which one is visible) would force a real focus/cursor
// jump every time you browsed to another monitor. Browsing (M / number keys
// / the monitor bar) instead just changes which monitor's workspace data
// this one fixed window displays; only activating a window (Enter/click)
// dispatches a real Hyprland focus change.
ShellRoot {
id: shell
property bool overviewOpen: false
property string browsedMonitor: ""
property var anchorScreen: null
onOverviewOpenChanged: {
if (shell.overviewOpen) {
const mon = Hyprland.focusedMonitor;
shell.browsedMonitor = mon ? mon.name : "";
shell.anchorScreen = Quickshell.screens.find(s => mon && s.name === mon.name) ?? Quickshell.screens[0];
}
}
IpcHandler {
target: "overview"
@@ -24,14 +45,11 @@ ShellRoot {
}
}
Variants {
model: Quickshell.screens
OverviewWindow {
required property var modelData
screen: modelData
shellOpen: shell.overviewOpen
onRequestClose: shell.overviewOpen = false
}
OverviewWindow {
screen: shell.anchorScreen
shellOpen: shell.overviewOpen
browsedMonitor: shell.browsedMonitor
onRequestClose: shell.overviewOpen = false
onRequestBrowseMonitor: name => shell.browsedMonitor = name
}
}