Questions tagged [nsstatusitem]

The NSStatusItem class represents the individual elements displayed within an NSStatusBar object.

218 questions
4
votes
1 answer

Detect when NSStatusItem is clicked if it has a menu?

I have a NSStatusItem that has a drop down menu when clicked: [statusItem setMenu:statusMenu]; Since I'm using a menu, this code will not detect when the status item gets clicked: [statusItem setAction:@selector(isClicked:)]; How can I use a menu…
Hope4You
  • 1,927
  • 4
  • 21
  • 45
4
votes
1 answer

Graphics error with NSStatusItem

My application uses NSStatusItem to be visible to the user. So I set 'Application is agent (UIElement)' to YES, which basically hides the menu bar of the application, and hides the icon from the dock. Now, I didn't delete the menu bar, so I can…
IluTov
  • 6,807
  • 6
  • 41
  • 103
4
votes
1 answer

Main Thread Runloop gets blocked on opening nsmenu

I have an application for which the UI element includes an NSStatusItem and a menu. Inside my application , I am using NSTask asynchronously to perform some operation and I am using the output obtained using the …
3
votes
1 answer

Minimize all window in mac but every time one window is active

I have added a code to minimize all the running application on NSStatusItem, its a very simple code [[NSWorkspace sharedWorkspace] hideOtherApplications]; But when i run this application then one application is always on the desktop the one with…
Radix
  • 3,639
  • 3
  • 31
  • 47
3
votes
1 answer

Detect click on OS X menu bar?

I'm curious if there's a trick to detecting a click on the Menu Bar as a whole. I know I can detect a click on an NSStatusItem or NSMenu, but I am looking for events pertaining to the empty space of the Menu Bar. Looking through the documentation,…
akaru
  • 6,299
  • 9
  • 63
  • 102
3
votes
2 answers

Toggle NSStatusItem's Menu Open/Closed Using Hot Key - Code Execution Queued/Blocked

I'm editing this question because I think I may have oversimplified the way in which my status item's menu opens. It's ridiculously complicated for such a simple function! My status item supports both left and right click actions. The user can…
3
votes
1 answer

Set menubar icon from ViewController

How to change the menubar icon of a MacOS app from another ViewController? AppDelegate.swift (inits menubar icon) ViewController.swift (tries to set menubar icon ❌) I found this but this isn't changing the menubar icon for me: Mac: How to save…
Mikeumus
  • 3,570
  • 9
  • 40
  • 65
3
votes
2 answers

How to display my app's icon (programmatically) on the top right corner of the Mac OS X menu bar

I know Skype does it - they have a special icon register to there. And then when user click on the icon, a drop down menu will appear...
tom
  • 14,273
  • 19
  • 65
  • 124
3
votes
2 answers

Editable NSTextField in custom view of NSMenuItem

I have a subclassed NSView that I would like to contain an editable NSTextField, similar to Spotlight. I am having significant difficult getting the text field to select and highlight. If I click quickly and rapidly over the editing area of the…
Andrew J. Freyer
  • 591
  • 2
  • 12
  • 38
3
votes
1 answer

Cocoa - Custom appearance of NSStatusItem in menu bar

It is easy to set the title and length of an NSStatusItem. Is is possible to change the appearance of the NSStatusItem entirely, and replace it with a custom view? For example, if I want my NSStatusItem to be a whole row of icons surrounded by a…
Chetan
  • 46,743
  • 31
  • 106
  • 145
3
votes
1 answer

NSStatusItem's menu are not shown in Full Screen Model for the Mac os 10.13.1

all: I have added one NSStatusItem in the status bar for my test app, and it works well in Mac ox 10.12, not only normal model, but also full screen model. When i switch to Mac os 10.13, it is failed to show the menu in the full screen…
stream hu
  • 41
  • 3
3
votes
2 answers

NSMenuItem Title which changes over time.

I would like to implement an NSStatusItem where the title changes over time. My ultimate goal is to display a countdown timer in the menu bar beside the image which I have set. Maybe I am going about this the wrong way. But I already have a…
dave
  • 51
  • 5
3
votes
2 answers

Double-click action for menu bar icon in Mac OSX

I'm writing a small Mac OSX app that displays a menu bar icon. When clicked, a menu pops up. I'd like to have a "default" action for the menu bar icon. Basically, to execute an action when double-clicking it, without having to select the action from…
DarkByte
  • 1,162
  • 8
  • 17
3
votes
1 answer

How to disable highlighted mode of NSStatusItem

I'd like to set disable highlighted mode of NSStatusItem when clicked. In OS X 10.10 and later version, highlightedMode property has been deprecated, and Apple suggest using button property. So, what's the equivalent of setHighlightedMode:? Swift or…
Chitanda_Eru
  • 51
  • 1
  • 5
3
votes
1 answer

NSClickGestureRecognizer not working on NSStatusItem

Trying to recognize a right click on a NSStatusItem I got a suggestion ( Thanks to Zoff Dino ) to use a NSClickGestureRecognizer for that. But for some bizarre reason it isn't working as it should be. I am able to recognize a left click (buttonMask…
Devapploper
  • 6,062
  • 3
  • 20
  • 41