Skip to content

Instantly share code, notes, and snippets.

@rderik
Created August 31, 2018 14:12
Show Gist options
  • Save rderik/e677cad4ad1e27258af61a28ea397cd6 to your computer and use it in GitHub Desktop.
Save rderik/e677cad4ad1e27258af61a28ea397cd6 to your computer and use it in GitHub Desktop.
testing hammerspoon
function dealWithKeys(evt)
curr_modifiers = evt:getFlags()
print(curr_modifiers["ctrl"])
print("========================")
mod_table = { ["ctrl"] = true }
print(mod_table['ctrl'])
if (curr_modifiers.contain({ "ctrl" })) then
print "Only has Control"
else
print "Might have something else"
end
for k,v in pairs(curr_modifiers) do
print("Key:")
print(k)
print("Value:")
print(v)
end
print("Dealt with")
end
tapping_code = hs.eventtap.new({hs.eventtap.event.types.flagsChanged},dealWithKeys)
tapping_code:start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment