hammerspoon: Invalid key: cmd - this may mean that the key requested does not exist in your keymap

Trying to toggle modifiers like command, is there a way to do this?

local cmdOn = hs.eventtap.event.newKeyEvent({}, 'cmd', true)
local cmdOff = hs.eventtap.event.newKeyEvent({}, 'cmd', false)
hs.hotkey.bind({}, 'f', cmdOn:post, cmdOff:post, nil)

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 28 (13 by maintainers)

Most upvoted comments

at present, no, hs.eventap is not able to create a flag change event without it being a part of a key down or key up event. a planned update will support this, but i don’t have a timeframe yet.