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 mo
This is deprecated in 10.10, but will continue to work:
[self.statusItem setTarget:self]; // Otherwise this goes to the first responder
[self.statusItem setAction:@selector(statusItemClicked:)];
[self.statusItem sendActionOn:(NSRightMouseUpMask)];
You can set other events in setActionOn by bitmasking them. So for instance if you wanted left and right click:
[self.statusItem sendActionOn:(NSLeftMouseUpMask | NSRightMouseUpMask)];
(Excuse the objC, you should be able to translate it into swift and it should work)