fix moving left / right
This commit is contained in:
+19
-3
@@ -174,9 +174,25 @@ end
|
||||
)
|
||||
hl.bind(mainMod .. " + SHIFT + Q", hl.dsp.window.close())
|
||||
|
||||
-- change focus
|
||||
hl.bind(mainMod .. " + LEFT", hl.dsp.focus({ direction = "left" }))
|
||||
hl.bind(mainMod .. " + RIGHT", hl.dsp.focus({ direction = "right" }))
|
||||
|
||||
-- move focus left / right. Using the layout or geometric method has quirks that this does nicely.
|
||||
local function focus_horizontal(dir) -- "l" or "r"
|
||||
local direction = (dir == "l") and "left" or "right"
|
||||
return function()
|
||||
local before = hl.get_active_window()
|
||||
hl.dispatch(hl.dsp.layout("focus " .. dir))
|
||||
local after = hl.get_active_window()
|
||||
|
||||
local same = (before == nil and after == nil)
|
||||
or (before and after and before.address == after.address)
|
||||
if same then
|
||||
hl.dispatch(hl.dsp.focus({ direction = direction }))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
hl.bind(mainMod .. " + LEFT", focus_horizontal("l"))
|
||||
hl.bind(mainMod .. " + RIGHT", focus_horizontal("r"))
|
||||
hl.bind(mainMod .. " + UP", hl.dsp.focus({ direction = "up" }))
|
||||
hl.bind(mainMod .. " + DOWN", hl.dsp.focus({ direction = "down" }))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user