feat: better binds
This commit is contained in:
@@ -2,19 +2,25 @@ local function exit_submap()
|
|||||||
hl.dispatch(hl.dsp.submap("reset"))
|
hl.dispatch(hl.dsp.submap("reset"))
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, 10, 1 do
|
local function add_workspace_keymap(bind_goto, bind_move, num)
|
||||||
hl.bind(
|
hl.bind(
|
||||||
"SUPER + " .. tostring(i % 10),
|
bind_goto,
|
||||||
hl.dsp.focus({ workspace = tostring(i) }),
|
hl.dsp.focus({ workspace = tostring(num) }),
|
||||||
{ description = "Go to workspace " .. tostring(i) }
|
{ description = "Go to workspace " .. tostring(num) }
|
||||||
)
|
)
|
||||||
hl.bind(
|
hl.bind(
|
||||||
"SUPER + SHIFT + " .. tostring(i % 10),
|
bind_move,
|
||||||
hl.dsp.window.move({ workspace = tostring(i), follow = 1 }),
|
hl.dsp.window.move({ workspace = tostring(num), follow = 1 }),
|
||||||
{ description = "Move window to workspace " .. tostring(i) }
|
{ description = "Move window to workspace " .. tostring(num) }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i = 1, 10, 1 do
|
||||||
|
add_workspace_keymap("SUPER + " .. tostring(i % 10), "SUPER + SHIFT + " .. tostring(i % 10), i)
|
||||||
|
end
|
||||||
|
-- Super + - for 11th workspace
|
||||||
|
add_workspace_keymap("SUPER + code:20", "SUPER + SHIFT + code:20", 11)
|
||||||
|
|
||||||
hl.bind("SUPER + h", hl.dsp.focus({ direction = "l" }), { description = "Focus next window to left" })
|
hl.bind("SUPER + h", hl.dsp.focus({ direction = "l" }), { description = "Focus next window to left" })
|
||||||
hl.bind("SUPER + l", hl.dsp.focus({ direction = "r" }), { description = "Focus next window to right" })
|
hl.bind("SUPER + l", hl.dsp.focus({ direction = "r" }), { description = "Focus next window to right" })
|
||||||
hl.bind("SUPER + j", hl.dsp.focus({ direction = "d" }), { description = "Focus next window below" })
|
hl.bind("SUPER + j", hl.dsp.focus({ direction = "d" }), { description = "Focus next window below" })
|
||||||
@@ -29,17 +35,9 @@ hl.bind(
|
|||||||
|
|
||||||
hl.define_submap("workspace", function()
|
hl.define_submap("workspace", function()
|
||||||
for i = 1, 10, 1 do
|
for i = 1, 10, 1 do
|
||||||
hl.bind(
|
add_workspace_keymap(tostring(i % 10), "SHIFT + " .. tostring(i % 10), i)
|
||||||
tostring(i % 10),
|
|
||||||
hl.dsp.focus({ workspace = tostring(i) }),
|
|
||||||
{ description = "Go to workspace " .. tostring(i) }
|
|
||||||
)
|
|
||||||
hl.bind(
|
|
||||||
"SHIFT + " .. tostring(i % 10),
|
|
||||||
hl.dsp.window.move({ workspace = tostring(i), follow = 1 }),
|
|
||||||
{ description = "Move window to workspace " .. tostring(i) }
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
add_workspace_keymap("code:20", "SHIFT + code:20", 11)
|
||||||
|
|
||||||
hl.bind("h", hl.dsp.focus({ direction = "l" }), { description = "Focus next window to left" })
|
hl.bind("h", hl.dsp.focus({ direction = "l" }), { description = "Focus next window to left" })
|
||||||
hl.bind("l", hl.dsp.focus({ direction = "r" }), { description = "Focus next window to right" })
|
hl.bind("l", hl.dsp.focus({ direction = "r" }), { description = "Focus next window to right" })
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ return function(is_laptop, is_docked)
|
|||||||
monitor = "DP-2",
|
monitor = "DP-2",
|
||||||
default = false,
|
default = false,
|
||||||
})
|
})
|
||||||
|
hl.workspace_rule({
|
||||||
|
workspace = "11",
|
||||||
|
monitor = "DP-2",
|
||||||
|
default = false,
|
||||||
|
})
|
||||||
elseif is_docked then
|
elseif is_docked then
|
||||||
hl.workspace_rule({
|
hl.workspace_rule({
|
||||||
workspace = "2",
|
workspace = "2",
|
||||||
@@ -31,5 +36,10 @@ return function(is_laptop, is_docked)
|
|||||||
monitor = "HDMI-A-1",
|
monitor = "HDMI-A-1",
|
||||||
default = false,
|
default = false,
|
||||||
})
|
})
|
||||||
|
hl.workspace_rule({
|
||||||
|
workspace = "11",
|
||||||
|
monitor = "HDMI-A-1",
|
||||||
|
default = false,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user