Files
OpenSpace/scripts/common_scripts.lua
Alexander Bock c9aedb084b Add Lua functions to query keyboard bindings and remove individual keybinds
Add core script file that defines possibility of rebinding keyboard commands to a different key
Enable the execution of global customization scripts
Make `scene_helper.lua` a script automatically included in the ScriptScheduler
2017-12-08 14:58:18 -05:00

21 lines
569 B
Lua

openspace.documentation = {
{
Name = "rebindKey",
Arguments = "string, string",
Documentation = "Rebinds all scripts from the old key (first argument) to the " ..
"new key (second argument)."
}
}
openspace.rebindKey = function(old_key, new_key)
local t = openspace.getKeyBinding(old_key)
openspace.clearKey(old_key)
for _, v in pairs(t) do
if v["Remote"] then
openspace.bindKey(new_key, v["Command"])
else
openspace.bindKeyLocal(new_key, v["Command"])
end
end
end