adding keymapping to the layout_manager

This commit is contained in:
Squibid 2025-12-20 16:30:03 -05:00
parent 7f847ee468
commit 0417918562
Signed by: squibid
GPG key ID: BECE5684D3C4005D
3 changed files with 59 additions and 7 deletions

View file

@ -0,0 +1,28 @@
--- This is a wrapper around mez's keymapping system to allow for data driven
--- keymaps. The advantage of using this over the raw keybinds is the ability
--- to unmap and map a list of keymaps at runtime without too much hassle.
---@class mapper.map
---@field modifiers string formatted like in mez.input.add_keymap
---@field keys string formatted like in mez.input.add_keymap
---@field options table formatted like in mez.input.add_keymap
local mapper = {}
--- map a table of maps
---@param maps mapper.map[]
function mapper.add(maps)
for _, map in ipairs(maps) do
mez.input.add_keymap(map.modifiers, map.keys, map.options)
end
end
--- del a table of maps
---@param maps mapper.map[]
function mapper.del(maps)
for _, map in ipairs(maps) do
mez.input.del_keymap(map.modifiers, map.keys)
end
end
return mapper