write keybind script in lua
This commit is contained in:
parent
21806b45fb
commit
76cb7597c1
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env lua
|
||||
|
||||
local bindings = {
|
||||
{
|
||||
'"Toggle terminal transparency"',
|
||||
'"${HOME}/scripts/toggle-term-transparency.sh"',
|
||||
"\"['<Primary>dead_acute']\"",
|
||||
},
|
||||
{ '"Toggle bg"', '"${HOME}/scripts/switch-bg.sh t"', "\"['<Primary>ccedilla']\"" },
|
||||
}
|
||||
local custom_list = '"['
|
||||
for i, _ in pairs(bindings) do
|
||||
custom_list = custom_list .. "'custom" .. (i - 1) .. "',"
|
||||
end
|
||||
custom_list = custom_list:sub(1, custom_list:len() - 1) .. ']"'
|
||||
print(custom_list)
|
||||
os.execute("gsettings set org.cinnamon.desktop.keybindings custom-list " .. custom_list)
|
||||
local gset = function(index, name, command, binding)
|
||||
print(
|
||||
"Setting keybinding custom"
|
||||
.. index
|
||||
.. ", with name "
|
||||
.. name
|
||||
.. ", command "
|
||||
.. command
|
||||
.. ", and binding "
|
||||
.. binding
|
||||
.. "."
|
||||
)
|
||||
local cmd = "gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom"
|
||||
.. index
|
||||
.. "/ name "
|
||||
.. name
|
||||
print(cmd)
|
||||
os.execute(cmd)
|
||||
cmd = "gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom"
|
||||
.. index
|
||||
.. "/ command "
|
||||
.. command
|
||||
print(cmd)
|
||||
os.execute(cmd)
|
||||
cmd = "gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom"
|
||||
.. index
|
||||
.. "/ binding "
|
||||
.. binding
|
||||
print(cmd)
|
||||
os.execute(cmd)
|
||||
end
|
||||
for i, binding in pairs(bindings) do
|
||||
gset(i - 1, binding[1], binding[2], binding[3])
|
||||
end
|
Loading…
Reference in New Issue