Skip to content

Support menu bar apps that uses NSMenu #1

Closed
@sindresorhus

Description

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions