Skip to content

Instantly share code, notes, and snippets.

@amasho
Created December 5, 2019 08:53
Show Gist options
  • Select an option

  • Save amasho/d47983c4ac5b9e84e73f4d43cd55bf9e to your computer and use it in GitHub Desktop.

Select an option

Save amasho/d47983c4ac5b9e84e73f4d43cd55bf9e to your computer and use it in GitHub Desktop.
Hammerspoon config
local function keyCode(key, mods, callback)
mods = mods or {}
callback = callback or function() end
return function()
hs.eventtap.event.newKeyEvent(mods, string.lower(key), true):post()
hs.timer.usleep(1000)
hs.eventtap.event.newKeyEvent(mods, string.lower(key), false):post()
callback()
end
end
local function remapKey(mods, key, keyCode)
hs.hotkey.bind(mods, key, keyCode, nil, keyCode)
end
remapKey({'ctrl'}, '[', keyCode('escape'))
remapKey({'ctrl'}, 'h', keyCode('delete'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment