Created
December 5, 2019 08:53
-
-
Save amasho/d47983c4ac5b9e84e73f4d43cd55bf9e to your computer and use it in GitHub Desktop.
Hammerspoon config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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