Last active
August 24, 2023 10:21
-
-
Save zzamboni/c5e31cb33ca3fcdee5f1e629ee028b62 to your computer and use it in GitHub Desktop.
How to catch the fn key using Hammerspoon
This file contains 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
-- Catch fn-h and convert it to a left arrow key. | |
function catcher(event) | |
if event:getFlags()['fn'] and event:getCharacters() == "h" then | |
print("fn-h!") | |
return true, {hs.eventtap.event.newKeyEvent({}, "left", true)} | |
end | |
return false | |
end | |
local tapper=hs.eventtap.new({hs.eventtap.event.types.keyDown}, catcher):start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment