Make monocle directional focus deterministic

This commit is contained in:
2026-04-28 15:40:44 -07:00
parent 2f29f7e5ba
commit a14c5a9708
2 changed files with 27 additions and 5 deletions

View File

@@ -78,7 +78,8 @@ verifier mode.
useful focus. useful focus.
- [x] Add "move to empty workspace on monitor in direction" without requiring - [x] Add "move to empty workspace on monitor in direction" without requiring
`Hyper+Ctrl`. `Hyper+Ctrl`.
- [ ] Verify directional focus in monocle behaves predictably. - [x] Route directional focus in monocle through deterministic Lua cycling.
- [ ] Live-verify directional focus in monocle behaves predictably.
## 4. Script Elimination Priority ## 4. Script Elimination Priority

View File

@@ -389,6 +389,19 @@ local function monocle_prev()
end end
end end
local function focus_direction(direction)
if current_layout == monocle_layout then
if direction == "up" or direction == "left" then
monocle_prev()
else
monocle_next()
end
return
end
hl.dsp.focus({ direction = direction })()
end
local function focus_workspace(workspace_id) local function focus_workspace(workspace_id)
hl.dsp.focus({ workspace = tostring(workspace_id), on_current_monitor = true })() hl.dsp.focus({ workspace = tostring(workspace_id), on_current_monitor = true })()
end end
@@ -1179,10 +1192,18 @@ bind(main_mod .. " + SHIFT + B", function()
enter_window_picker("replace") enter_window_picker("replace")
end) end)
bind(main_mod .. " + W", hl.dsp.focus({ direction = "up" })) bind(main_mod .. " + W", function()
bind(main_mod .. " + S", hl.dsp.focus({ direction = "down" })) focus_direction("up")
bind(main_mod .. " + A", hl.dsp.focus({ direction = "left" })) end)
bind(main_mod .. " + D", hl.dsp.focus({ direction = "right" })) bind(main_mod .. " + S", function()
focus_direction("down")
end)
bind(main_mod .. " + A", function()
focus_direction("left")
end)
bind(main_mod .. " + D", function()
focus_direction("right")
end)
bind(main_mod .. " + SHIFT + W", hl.dsp.window.swap({ direction = "up" })) bind(main_mod .. " + SHIFT + W", hl.dsp.window.swap({ direction = "up" }))
bind(main_mod .. " + SHIFT + S", hl.dsp.window.swap({ direction = "down" })) bind(main_mod .. " + SHIFT + S", hl.dsp.window.swap({ direction = "down" }))