Remap ctrl-h to delete for Skype.app with hammerspoon config
local function enableHotkeys(hotkeys) | |
for k, v in pairs(hotkeys) do | |
v:enable() | |
end | |
end | |
local function disableHotkeys(hotkeys) | |
for k, v in pairs(hotkeys) do | |
v:disable() | |
end | |
end | |
local function keyCode(key, mods) | |
mods = mods or {} | |
return function() | |
hs.eventtap.event.newKeyEvent(mods, key, true):post() | |
hs.timer.usleep(1000) | |
hs.eventtap.event.newKeyEvent(mods, key, false):post() | |
end | |
end | |
local function hotkey(mods, key, keyCode) | |
return hs.hotkey.new(mods, key, keyCode, nil, keyCode) | |
end | |
-- watch hotkey settings | |
local function handleGlobalAppEvent(name, event, app) | |
if event == hs.application.watcher.activated then | |
if name == 'Skype' then | |
enableHotkeys(skypeConf) | |
else | |
disableHotkeys(skypeConf) | |
end | |
end | |
end | |
appWatcher = hs.application.watcher.new(handleGlobalAppEvent) | |
appWatcher:start() | |
-- remap settings | |
skypeConf = { | |
hotkey({'ctrl'}, 'h', keyCode('delete')), | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment