I am writing a simple status bar app in Swift, and attempting to use the new NSStatusItem API introduced in OS X 10.10.
The interface I'm aiming for is a simple left mouse click on the statusItem to toggle a core feature on and off, with a right mouse click (or control-click) option to show a settings menu. I have no need for a custom view or popover for this functionality.
By default, if a NSMenu is assigned to a NSStatusItem, it will display the menu on both a left and right click. I want to change the behaviour to only show the menu on a right click, or as a workaround, prevent the menu popping up on a left click
Previously, it seems that to get control of mouse events on a NSStatusItem, one had to set a custom view with overridden mouse events (see this related question).
In the new NSStatusItem API introduced in 10.10, methods for setting a custom view have been deprecated, and it looks like this behaviour is discouraged. According to @Taylor in this answer a few of the deprecated behaviours should be used through the NSStatusBarButton object returned by statusItemObject.button() but as of writing there is no documentation for NSStatusBarButton, and the object returned is read-only and cannot be replaced with a custom button with overridden mouse event handlers.
Is there a way to bring some level of control to whether an NSMenu attached to an NSStatusItem (or an NSStatusBarButton) is displayed with regard to mouse events?