Compare commits

..

2 Commits

Author SHA1 Message Date
andrzej 76cb7597c1 write keybind script in lua 2024-05-15 17:29:05 +02:00
andrzej 21806b45fb add quotes 2024-05-15 17:28:49 +02:00
2 changed files with 54 additions and 3 deletions

51
scripts/keybindings.lua Executable file
View File

@ -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

View File

@ -9,9 +9,9 @@
set(){
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom${1}/ name "${2}"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom${1}/ command "${3}"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom${1}/ binding "${4}"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom"${1}"/ name "${2}"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom"${1}"/ command "${3}"
gsettings set org.cinnamon.desktop.keybindings.custom-keybinding:/org/cinnamon/desktop/keybindings/custom-keybindings/custom"${1}"/ binding "${4}"
}
## Terminal