The NSStatusItem class represents the individual elements displayed within an NSStatusBar object.
Questions tagged [nsstatusitem]
218 questions
40
votes
16 answers
Cocoa Keyboard Shortcuts in Dialog without an Edit Menu
I have an LSUIElement application that displays a menubar status item. The application can display a dialog window that contains a text field.
If the user right-clicks/control-clicks the text field, a menu appears that allows cut, copy, paste, etc.…

Kristopher Johnson
- 81,409
- 55
- 245
- 302
26
votes
6 answers
NSStatusItem change image for dark tint
With OSX 10.10 beta 3, Apple released their dark tint option. Unfortunately, it also means that pretty much all status bar icons (with the exception of Apple's and Path Finder's that I've seen), including mine, remain dark on a dark background. How…

Joel Fischer
- 6,521
- 5
- 35
- 46
19
votes
2 answers
Can an NSStatusItem be shrunk to fit?
I have a variable length NSStatusItem which I'd like to stay visible whenever possible, even if that means showing only some of the content, but when my item is wide enough to run into an application's menu bar, it is hidden entirely. Is there a way…

alltom
- 3,162
- 4
- 31
- 47
16
votes
3 answers
Left vs Right Click Status Bar Item Mac Swift 2
I have been trying to develop a simple program that sits in the Mac's status bar. I need it so that if you left click, it runs a function, but if you right click it displays a menu with an About and Quit item.
I have been looking but all I could…

Joe Izzard
- 263
- 3
- 7
16
votes
10 answers
NSStatusBarButton keep highlighted
As of OS X 10.10 most of NSStatusItem has been deprecated in favour of the button property, which consists of an NSStatusBarButton. It should work like a normal button but unfortunately the cell and setCell methods in NSStatusButton have also been…

Luke
- 4,908
- 1
- 37
- 59
15
votes
2 answers
Drag and Drop with NSStatusItem
I'm trying to write an application that allows the user to drag files from the Finder and drop them onto an NSStatusItem. So far, I've created a custom view that implements the drag and drop interface. When I add this view as a subview of an…

Bryan Kyle
- 13,361
- 4
- 40
- 45
14
votes
7 answers
How to get the on-screen location of an NSStatusItem
I have a question about the NSStatusItem for cocoa in mac osx. If you look at the mac app called snippets (see the movie at http://snippetsapp.com/). you will see that once you clicked your statusbar icon that a perfectly aligned view / panel or…

Johnny Mast
- 703
- 1
- 9
- 17
12
votes
1 answer
Detect if the screen is being recorded on macOS
I'm looking for a way to detect if the screen is currently being recorded.
Ideally, an event for when the recording starts/stops. Maybe some kind of distributed notification.
My use-case is that I would like to hide my app's menu bar item while the…

Sindre Sorhus
- 62,972
- 39
- 168
- 232
12
votes
6 answers
How to get frame for NSStatusItem
Is it possible to get the frame of a NSStatusItem after I've added it to the status bar in Cocoa? When my app is launched, I am adding an item to the system status bar, and would like to know where it was positioned, is possible.

marcc
- 12,295
- 7
- 49
- 59
10
votes
3 answers
Cocoa: Right Click NSStatusItem
I am a .Net developer who need to port a small project into Mac, so I know next to nothing about Objective C. In fact the code below was just a bunch of grasping at straws and shooting in the dark.
Trying to build a Status Menu program that opens…

Dan
- 103
- 1
- 5
9
votes
1 answer
NSDatePicker in NSStatusBar NSSMenuItem not receiving input
A while back I wrote a simple calendar menu bar widget called Day-O. The calendar uses the stock NSDatePicker nested inside an NSView inside an NSMenuItem in an NSMenu added to an NSStatusItem. The app has an activationPolicy of .accessory…

Shaun Inman
- 1,968
- 1
- 19
- 28
9
votes
2 answers
How can I vertically align my status bar item text?
Left one on the picture is the date and time from Apple and one is my application one. As you may see the text of my application appears lower than the Apple one. Which doesn't look pretty. How can this be resolved?
self.statusBarItem.image …

Mark
- 16,906
- 20
- 84
- 117
9
votes
2 answers
Swift: NSStatusItem menu behaviour in 10.10 (e.g. show only on right mouse click)
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…

Kieran
- 771
- 7
- 14
9
votes
3 answers
Is it possible to add a NSStatusItem to a specific position in NSStatusBar?
I use self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; to add an statusItem to the systemStatusBar on OSX. The statusItem then appears on the left-most position in the systemStatusBar. I was…

mxmln
- 91
- 2
9
votes
7 answers
Custom NSView in NSMenuItem not receiving mouse events
I have an NSMenu popping out of an NSStatusItem using popUpStatusItemMenu. These NSMenuItems show a bunch of different links, and each one is connected with setAction: to the openLink: method of a target. This arrangement has been working fine for…

Dennis
- 1,215
- 1
- 12
- 15