I have an NSStatusItem
with an attached menu that I'm triggering with a global hotkey. If I click the menu item I get the highlight as usual, if I use the hotkey the highlight isn't triggered. Does anyone know a way to trigger the highlight?
I've tried overriding the view and drawing it myself in drawRect
but if there is a nicer way to do it I'd love to hear. Thanks!
The reason I don't want to override the view is then I have to handle icon positioning, clicking to activate the menu, etc.
This does the magic in macOS 10.13.6 with Xcode 10.
Please note that last line is required to de-highlight the icon when the menu gets closed.
Use:
[[statusItem button] highlight:true];
As it turns out
setHighlighted:
andhighlight
don't do the same thing:NSStatusBarButton keep highlighted