Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
"auto alt + yen" watcher #hammerspoon
-- based on: http://qiita.com/tanakahisateru/items/d8a67ad89c07baf8c0da
local VK_JIS_YEN = 0x5d
watcher = hs.eventtap.new({
hs.eventtap.event.types.keyDown
}, function(event)
local code = event:getKeyCode()
-- hs.logger.new('test', 'debug').d(code)
if code == VK_JIS_YEN then
local flag = event:getFlags()
flag['alt'] = not flag['alt'] -- "reverse" alt flag
event:setFlags(flag)
end
end)
watcher:start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment