carousel for overiview
This commit is contained in:
1 parent
9031fae5e3
commit
765ddd8525
7 files changed
+169
-42
No files matched your search
@@ -74,7 +74,11 @@ hypr/
|
|||||||
|
|
||||||
- `Mod+Shift+H` (show-hotkey-overlay) — no native Hyprland equivalent; left commented.
|
- `Mod+Shift+H` (show-hotkey-overlay) — no native Hyprland equivalent; left commented.
|
||||||
- `Mod+Escape` (toggle-keyboard-shortcuts-inhibit) — no native equivalent; omitted.
|
- `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);
|
- `Mod+Tab` (toggle-overview) — the Quickshell scrolling overview (see above);
|
||||||
previously a pure-Lua wofi picker, then the ScrollOverview plugin, and
|
previously a pure-Lua wofi picker, then the ScrollOverview plugin, and
|
||||||
`cyclenext` before that.
|
`cyclenext` before that.
|
||||||
|
|||||||
@@ -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)
|
-- niri: toggle-column-tabbed-display (closest: group/tab windows together)
|
||||||
hl.bind(mod .. " + W", hl.dsp.group.toggle())
|
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)`
|
-- 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.window.fullscreen({ mode = "maximized", action = "toggle" }))
|
||||||
-- hl.bind(mod .. " + F", hl.dsp.layout("colresize +conf"))
|
-- hl.bind(mod .. " + F", hl.dsp.layout("colresize +conf"))
|
||||||
|
|||||||
@@ -111,10 +111,29 @@ function dsp_window.drag() end
|
|||||||
---@class hl.dsp.group
|
---@class hl.dsp.group
|
||||||
local 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.
|
---Toggle the focused window's group/tab mode.
|
||||||
---@return hl.DispatcherValue
|
---@return hl.DispatcherValue
|
||||||
function dsp_group.toggle() end
|
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
|
---@class hl.dsp.workspace
|
||||||
local dsp_workspace = {}
|
local dsp_workspace = {}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
plugin (Hyprland has none maintained against tagged releases — see
|
||||||
`modules/nixos/desktop/tiler/ABOUTME.md`).
|
`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
|
horizontal strip of that workspace's windows (columns), sorted by x-position
|
||||||
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, `M` cycles to the next monitor's overview, number keys 1-9 jump
|
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
|
straight to the Nth monitor (sorted by Hyprland's monitor id) — also
|
||||||
window card also recenters the carousel on it (selection-only, doesn't
|
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.
|
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
|
- **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).
|
||||||
- **Focus dispatch:** classic `hyprctl`-style dispatcher strings
|
- **Focus dispatch:** this Hyprland build's `hyprctl dispatch <name> <args>`
|
||||||
(`"workspace " + id`, `"focuswindow address:" + addr`) via
|
no longer accepts classic freeform dispatch text at all — every request is
|
||||||
`Hyprland.dispatch(...)` — these work regardless of whether Hyprland's
|
evaluated as Lua (`hl.dispatch(<text>)`), so the text must already be a
|
||||||
config is Lua or hyprlang, unlike the Lua-eval dispatch form.
|
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
|
### Files
|
||||||
|
|
||||||
```
|
```
|
||||||
overview/
|
overview/
|
||||||
├── shell.qml # ShellRoot: IpcHandler (target "overview": toggle/open/close)
|
├── shell.qml # ShellRoot: IpcHandler (target "overview": toggle/open/close),
|
||||||
│ # + Variants { model: Quickshell.screens } instantiating one
|
│ # sets browsedMonitor + anchorScreen on open, owns the single
|
||||||
│ # OverviewWindow per monitor
|
│ # OverviewWindow instance
|
||||||
├── OverviewWindow.qml # per-monitor PanelWindow (layer-shell overlay); builds the
|
├── OverviewWindow.qml # the one PanelWindow (layer-shell overlay), anchored to
|
||||||
│ # workspace/window model from Quickshell.Hyprland, owns
|
│ # anchorScreen for the whole open session; builds the browsed
|
||||||
│ # selection state, key handling, and HyprlandFocusGrab
|
│ # monitor's workspace/window model from Quickshell.Hyprland,
|
||||||
├── WorkspaceRow.qml # one workspace = horizontal Row of WindowCards + label
|
│ # 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
|
├── WindowCard.qml # live ScreencopyView preview + icon/title footer + selection ring
|
||||||
└── Theme.qml # plain QtObject with colors/sizes, instantiated once per
|
└── Theme.qml # plain QtObject with colors/sizes/carousel tuning, instantiated
|
||||||
# OverviewWindow and prop-drilled down (no singleton/qmldir)
|
# once per OverviewWindow and prop-drilled down (no singleton/qmldir)
|
||||||
```
|
```
|
||||||
|
|
||||||
`Theme.qml` and the other sibling `.qml` files are used without explicit
|
`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
|
id: root
|
||||||
|
|
||||||
required property bool shellOpen
|
required property bool shellOpen
|
||||||
|
required property string browsedMonitor
|
||||||
signal requestClose()
|
signal requestClose()
|
||||||
|
signal requestBrowseMonitor(string name)
|
||||||
|
|
||||||
readonly property var monitor: Hyprland.monitorFor(root.screen)
|
visible: root.shellOpen
|
||||||
readonly property bool monitorFocused: monitor && Hyprland.focusedMonitor && monitor.id === Hyprland.focusedMonitor.id
|
|
||||||
visible: root.shellOpen && root.monitorFocused
|
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
@@ -40,13 +40,12 @@ PanelWindow {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Workspace rows for this monitor, top-to-bottom by workspace id. Special
|
// Workspace rows for the browsed monitor, top-to-bottom by workspace id.
|
||||||
// (scratchpad) workspaces have negative ids and are excluded.
|
// Special (scratchpad) workspaces have negative ids and are excluded.
|
||||||
readonly property var rows: {
|
readonly property var rows: {
|
||||||
const mon = root.monitor;
|
if (!root.browsedMonitor || !Hyprland.workspaces) return [];
|
||||||
if (!mon || !Hyprland.workspaces) return [];
|
|
||||||
const workspaces = Hyprland.workspaces.values
|
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);
|
.sort((a, b) => a.id - b.id);
|
||||||
return workspaces.map(ws => ({ workspace: ws, toplevels: root.sortedToplevels(ws) }));
|
return workspaces.map(ws => ({ workspace: ws, toplevels: root.sortedToplevels(ws) }));
|
||||||
}
|
}
|
||||||
@@ -104,21 +103,24 @@ PanelWindow {
|
|||||||
root.requestClose();
|
root.requestClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switches Hyprland's focused monitor; the overview stays open since
|
// Advances which monitor's overview is being browsed (see shell.qml) —
|
||||||
// `shellOpen` is shared across all monitors' OverviewWindow instances —
|
// purely local UI state, doesn't touch Hyprland's real focused monitor.
|
||||||
// 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() {
|
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) : []
|
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) {
|
function focusMonitorByIndex(i) {
|
||||||
const mon = root.sortedMonitors[i];
|
const mon = root.sortedMonitors[i];
|
||||||
if (!mon) return;
|
if (!mon) return;
|
||||||
Quickshell.execDetached(["hyprctl", "dispatch", `hl.dsp.focus({monitor = "${mon.name}"})`]);
|
root.requestBrowseMonitor(mon.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
@@ -225,6 +227,16 @@ PanelWindow {
|
|||||||
event.accepted = true;
|
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 {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,35 @@
|
|||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
|
||||||
// Scrolling overview for Hyprland — vertical stack of workspace rows on the
|
// 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
|
// Toggle with `qs -c overview ipc call overview <toggle|open|close>`; wired
|
||||||
// to Mod+Tab and a 4-finger swipe in the Hyprland config.
|
// 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 {
|
ShellRoot {
|
||||||
id: shell
|
id: shell
|
||||||
|
|
||||||
property bool overviewOpen: false
|
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 {
|
IpcHandler {
|
||||||
target: "overview"
|
target: "overview"
|
||||||
@@ -24,14 +45,11 @@ ShellRoot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Variants {
|
OverviewWindow {
|
||||||
model: Quickshell.screens
|
screen: shell.anchorScreen
|
||||||
|
shellOpen: shell.overviewOpen
|
||||||
OverviewWindow {
|
browsedMonitor: shell.browsedMonitor
|
||||||
required property var modelData
|
onRequestClose: shell.overviewOpen = false
|
||||||
screen: modelData
|
onRequestBrowseMonitor: name => shell.browsedMonitor = name
|
||||||
shellOpen: shell.overviewOpen
|
|
||||||
onRequestClose: shell.overviewOpen = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user