mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-07 19:49:53 -05:00
adding keymapping to the layout_manager
This commit is contained in:
parent
7f847ee468
commit
0417918562
3 changed files with 59 additions and 7 deletions
28
runtime/share/mezzaluna/mapper.lua
Normal file
28
runtime/share/mezzaluna/mapper.lua
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue