Layout-specific keybinds #13432
Replies: 6 comments 5 replies
-
|
it will likely be something I'll make sure is possible once we get the lua script api in |
Beta Was this translation helpful? Give feedback.
-
|
Any update on this @vaxerski? I haven't messed with my home machine in awhile, so I'm a few months behind the Monocle layout. Ideally, what I'd like to be able to do is have Currently, I have this.. but it's just not working at all. Also, I haven't really thought through how to handle using hl.bind(mainMod .. " + h", function()
local current = hl.get_active_workspace().tiled_layout
if current == "monocle" then
-- hl.dsp.window.cycle_next({ next = false, tiled = true })
hl.dsp.layout("cycleprev")
else
hl.dsp.focus({ direction = "left" })
end
end)
hl.bind(mainMod .. " + l", function()
local current = hl.get_active_workspace().tiledLayout
if current == "monocle" then
-- hl.dsp.window.cycle_next({ next = true, tiled = true })
hl.dsp.layout("cyclenext")
else
hl.dsp.focus({ direction = "right" })
end
end) |
Beta Was this translation helpful? Give feedback.
-
|
I've been trying to figure this out as well. I wanted to avoid having to define each duplicate key bind as it seemed like it was just going to become a mess. Vibe coded, though, so take it for what it is. A native option to achieve this would be nice. Thought it might be helpful to someone. local layoutBinds = {
dwindle = {
[mainMod .. " + Z"] = hl.dsp.layout("togglesplit"),
[mainMod .. " + S"] = hl.dsp.layout("swapsplit"),
[mainMod .. " + SHIFT + up"] = hl.dsp.layout("movetoroot"),
},
master = {
[mainMod .. " + SHIFT + left"] = hl.dsp.layout("swapwithmaster"),
[mainMod .. " + SHIFT + right"] = hl.dsp.layout("swapwithmaster"),
[mainMod .. " + SHIFT + up"] = hl.dsp.layout("swapprev"),
[mainMod .. " + SHIFT + down"] = hl.dsp.layout("swapnext"),
},
scrolling = {
[mainMod .. " + SHIFT + left"] = hl.dsp.layout("swapcol l"),
[mainMod .. " + SHIFT + right"] = hl.dsp.layout("swapcol r"),
},
monocle = {
[mainMod .. " + left"] = hl.dsp.layout("cycleprev"),
[mainMod .. " + right"] = hl.dsp.layout("cyclenext"),
},
}
local allKeys = {}
for _, binds in pairs(layoutBinds) do
for key in pairs(binds) do
allKeys[key] = true
end
end
for key in pairs(allKeys) do
hl.bind(key, function()
local layout = hl.get_config("general.layout")
local binds = layoutBinds[layout]
local action = binds and binds[key]
if action then
hl.dispatch(action)
end
end)
endMaybe we could get a bind flag for this? Something like { layout = scrolling } or { scrolling = true }, etc...? |
Beta Was this translation helpful? Give feedback.
-
local function layout_bind(table)
return function()
local layout = hl.get_active_workspace().tiled_layout
if table[layout] then
hl.dispatch(table[layout])
end
end
end
bind(
"KEY",
layout_bind({
scrolling = hl.dsp.layout("swapcol l"),
})
) |
Beta Was this translation helpful? Give feedback.
-
|
In case its useful, i have solved this by creating a submap per layout and switching submap by using hl.on("monitor.layout_changed", function ()
local layout = hl.get_config("general.layout")
hl.dispatch(hl.dsp.submap(layout))
end)and create the submaps with the name of the layout hl.define_submap("scrolling", function()
hl.bind("SUPER + left", hl.dsp.layout("focus l"))
...
end)
hl.define_submap("dwindle", function()
hl.bind( "SUPER + left", hl.dsp.focus({ workspace = "e-1" }))
...
end)this requires to mark all global bindings with submap_universal = true |
Beta Was this translation helpful? Give feedback.
-
|
Not sure if this is the right discussion place for this type of questions, but I would really appreciate some help on clarifying hjkl keybinds for window navigation. It seems that dwindle, master, spiral, and manual layout engines don't seem to cooperate with these particular set of keybinds to navigate the spatial layout of the windows on screen: hl.bind(mainMod .. " + h", hl.dsp.focus({direction = "l"})) Can anyone give me some advice on what I may be doing wrong? I can provide my hyprland.lua file as well if needed! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be great it if you could have the same bind do different things based on the current layout. I understand that this feature has been partially added in the form of layout-agnostic 'layoutmsg' calls, but a native option would streamline the keybind system and add make binds easier to remember.
Beta Was this translation helpful? Give feedback.
All reactions