Support menu bar apps that uses `NSMenu`
sindresorhus opened this issue · 0 comments
It currently doesn't work for menu bar that uses NSMenu
. This is because NSMenu
puts the event loop into a special tracking mode when the menu is open, which means the keyboard shortcut event will only arrive when the menu closes.
It should be possible to implement this by setting up a Carbon local event monitor instead when the menu is open. I have already made an swifty wrapper for it: https://gist.github.com/sindresorhus/2bb90276ad608a22ee5e8fb291b35b88 So we just need to use that instead when NSMenu
is open.
The workaround for now is to disable the shortcut when the menu is open, register a local shortcut using the above code, and then when the menu closes, enable the global shortcut again.
If you want to work on this, please read my comment in #28 (comment).