From 9c08a9943ac25e68193af459ea831b9bbf9cf9d7 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Mon, 31 Aug 2026 14:18:30 -0400 Subject: [PATCH] added monitors to overview --- configs/fwbook/hypr/ABOUTME.md | 8 +-- configs/fwbook/hypr/conf/keybindings.lua | 21 ++++++-- configs/fwbook/hypr/types/hl.lua | 21 ++------ configs/fwbook/quickshell/ABOUTME.md | 4 +- .../fwbook/quickshell/overview/MonitorBar.qml | 49 ++++++++++++++++--- 5 files changed, 68 insertions(+), 35 deletions(-) diff --git a/configs/fwbook/hypr/ABOUTME.md b/configs/fwbook/hypr/ABOUTME.md index 64f6121..67bd91e 100644 --- a/configs/fwbook/hypr/ABOUTME.md +++ b/configs/fwbook/hypr/ABOUTME.md @@ -75,10 +75,10 @@ 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. 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). + analog. Additional group binds were added on top via `hyprctl dispatch` (the extra + dispatchers aren't wrapped by `hl.dsp`): `Mod+Shift+W` (merge into an adjacent group), + `Mod+Alt+W` (pull out of a group), `Mod+Alt+Left/Right` (cycle through the active + group's tabs; no-op outside a group), 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. diff --git a/configs/fwbook/hypr/conf/keybindings.lua b/configs/fwbook/hypr/conf/keybindings.lua index 6afd21a..1007c00 100644 --- a/configs/fwbook/hypr/conf/keybindings.lua +++ b/configs/fwbook/hypr/conf/keybindings.lua @@ -50,14 +50,25 @@ 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" })) +-- (these dispatchers aren't in hl.dsp; use hyprctl like the gesture binds) +hl.bind(mod .. " + SHIFT + W", function() + hl.exec_cmd("hyprctl dispatch moveintogroup l") +end) -- 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" })) +hl.bind(mod .. " + ALT + W", function() + hl.exec_cmd("hyprctl dispatch moveoutofgroup l") +end) -- 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")) +hl.bind(mod .. " + ALT + right", function() + hl.exec_cmd("hyprctl dispatch changegroupactive f") +end) +hl.bind(mod .. " + ALT + left", function() + hl.exec_cmd("hyprctl dispatch changegroupactive b") +end) -- niri: (no feat.) lock/unlock the group so its tabs can't be rearranged -hl.bind(mod .. " + SHIFT + G", hl.dsp.group.lock()) +hl.bind(mod .. " + SHIFT + G", function() + hl.exec_cmd("hyprctl dispatch lockactivegroup toggle") +end) -- 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")) diff --git a/configs/fwbook/hypr/types/hl.lua b/configs/fwbook/hypr/types/hl.lua index 9d4d7a3..6ac6703 100644 --- a/configs/fwbook/hypr/types/hl.lua +++ b/configs/fwbook/hypr/types/hl.lua @@ -111,28 +111,13 @@ 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 +-- group dispatchers beyond `toggle` (moveintogroup/moveoutofgroup, +-- changegroupactive, lockactivegroup) aren't wrapped by hl.dsp; +-- keybindings.lua reaches them via `hl.exec_cmd("hyprctl dispatch ...")`. ---@class hl.dsp.workspace local dsp_workspace = {} diff --git a/configs/fwbook/quickshell/ABOUTME.md b/configs/fwbook/quickshell/ABOUTME.md index 8df5f70..edad8fc 100644 --- a/configs/fwbook/quickshell/ABOUTME.md +++ b/configs/fwbook/quickshell/ABOUTME.md @@ -59,7 +59,9 @@ overview/ │ # 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 +├── MonitorBar.qml # mini-map of clickable per-monitor pills, positioned AND sized +│ # proportionally to each monitor's real x/y/resolution (like a +│ # display-arrangement UI); 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/carousel tuning, instantiated diff --git a/configs/fwbook/quickshell/overview/MonitorBar.qml b/configs/fwbook/quickshell/overview/MonitorBar.qml index 4450f7e..c7dfbf7 100644 --- a/configs/fwbook/quickshell/overview/MonitorBar.qml +++ b/configs/fwbook/quickshell/overview/MonitorBar.qml @@ -1,6 +1,9 @@ import QtQuick -Row { +// Mini-map of the real monitor layout: each pill is positioned and sized +// proportionally to its monitor's actual x/y/resolution in Hyprland's +// compositor space (see conf/monitors.lua), like a display-arrangement UI. +Item { id: root required property var theme @@ -9,8 +12,34 @@ Row { signal monitorClicked(int index) - spacing: theme.cardSpacing * 0.5 + readonly property real mapWidth: 240 + readonly property real minPillWidth: 34 + readonly property real minPillHeight: 26 + + // Hyprland reports width/height as raw output resolution but x/y in + // scaled/logical space, so divide by scale to put everything in the + // same coordinate system before computing positions/sizes. + function logicalRect(m) { + return { x: m.x, y: m.y, w: m.width / m.scale, h: m.height / m.scale }; + } + + readonly property var rects: root.monitors.map(root.logicalRect) + readonly property var bounds: { + if (root.rects.length === 0) return { minX: 0, minY: 0, maxX: 1, maxY: 1 }; + return { + minX: Math.min(...root.rects.map(r => r.x)), + minY: Math.min(...root.rects.map(r => r.y)), + maxX: Math.max(...root.rects.map(r => r.x + r.w)), + maxY: Math.max(...root.rects.map(r => r.y + r.h)), + }; + } + readonly property real totalWidth: Math.max(1, root.bounds.maxX - root.bounds.minX) + readonly property real totalHeight: Math.max(1, root.bounds.maxY - root.bounds.minY) + readonly property real scaleFactor: root.mapWidth / root.totalWidth + visible: monitors.length > 1 + width: root.totalWidth * root.scaleFactor + height: root.totalHeight * root.scaleFactor Repeater { model: root.monitors @@ -21,20 +50,26 @@ Row { required property int index readonly property bool active: modelData.name === root.focusedMonitorName + readonly property var rect: root.logicalRect(modelData) - width: label.implicitWidth + 24 - height: 32 - radius: height / 2 + x: (rect.x - root.bounds.minX) * root.scaleFactor + y: (rect.y - root.bounds.minY) * root.scaleFactor + width: Math.max(rect.w * root.scaleFactor, root.minPillWidth) + height: Math.max(rect.h * root.scaleFactor, root.minPillHeight) + radius: 6 color: pill.active ? root.theme.selectedBorder : root.theme.cardBg border.width: 1 border.color: root.theme.cardBorder + clip: true Text { - id: label anchors.centerIn: parent + width: parent.width - 4 + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight text: (pill.index + 1) + ": " + pill.modelData.name color: root.theme.textColor - font.pixelSize: 12 + font.pixelSize: Math.max(9, Math.min(11, pill.height * 0.3)) font.bold: pill.active }