The NSStatusItem class represents the individual elements displayed within an NSStatusBar object.
Questions tagged [nsstatusitem]
218 questions
0
votes
2 answers
MAAttachedWindow for NSStatusItem without a custom view
I have a simple app that has a NSStatusItem, which only displays an icon.
I would now like to add functionality that would make a MAAttachedWindow appear under the NSStatusItem.
I saw the demo code Matt Gemmel provided; the code he uses to make the…

houbysoft
- 32,532
- 24
- 103
- 156
0
votes
1 answer
Creating status item - icon shows up, menu doesn't
In a document-based project I am trying to create a status menu. I have a singleton class that builds the status bar, and I am initiating it from an application delegate, as you can see. When I run this, I get no errors, but only an image of the…

janeh
- 3,734
- 7
- 26
- 43
0
votes
0 answers
Possible to have multiple buttons in a StatusItem on MacOS?
I'm trying to build a timer app on MacOS that would show the remaining time in the status bar.
Wondering if it's possible to show multiple buttons there at once? E.g. show play/pause button, reset button and the time right in the status bar.
Or are…

renal
- 39
- 4
0
votes
1 answer
NSStatusItem icon randomly dissappearing
I'm trying to figure out a weird problem that's happening with my menu bar app. It would run perfectly fine for a couple of hours or even days but would randomly disappear from the menu bar.
In activity monitor, it's still running in the background.…

swiftnoob
- 303
- 1
- 5
- 21
0
votes
1 answer
MacOS-Drag String onto NSStatusItem
I am trying to detect when a string is getting dragged onto the NSStatusItem. Here is the implementation of my code in AppDelegate:
func applicationDidFinishLaunching(_ aNotification: Notification) {
if let button = statusItem.button {
…

reza23
- 3,079
- 2
- 27
- 42
0
votes
1 answer
refresh NSMenuItem on click/open of NSStatusItem
I have the following extension where I have a NSMenuItem with it's state being either on or off:
extension AppDelegate {
func createStatusBarItem() {
let sBar = NSStatusBar.system
// create status bar item in system…

Christian
- 29
- 4
0
votes
1 answer
Make MAAttachedWindow to behave like NSMenu
I've read a post on this site on how to hide an MAAttachedWindow when the user clicks outside of it. As at this post, I use the MAAttachedWindow together with a statusItem.
Hide MAAttachedWindow when clicking outside.
It says I should hide the…

Wolfgang
- 35
- 6
0
votes
1 answer
Misaligned NSAttributedString in macOS NSStatusItem's button
I would like to display a two-line NSAttributedString as the button title of the NSStatusItem of my macOS app.
However, it seems to move the text up a few pixels and, thus, cut it off. This problem did not occur before macOS Big…

Lukas Würzburger
- 6,543
- 7
- 41
- 75
0
votes
1 answer
How to display multiple rows in macos menubar app?
Originally I thought adding new line should work. The problem is, the line height is too big. How can I make it more dense(closer to each other)?
There's the following example on git starting line 41. But apple docs say that custom view inside of…

kirqe
- 2,431
- 4
- 37
- 63
0
votes
1 answer
Cocoa: Auto close a status menu
I hava a status menu on the status bar, and I have some tasks running behind the scene. When one of task is done, assume at the time the menu is being showed (dropped down), I want to make the menu to be not in drop down mode (pretend doing a left…

tom
- 14,273
- 19
- 65
- 124
0
votes
3 answers
`NSStatusItem` created from `main()` doesn't show up on system status bar
I'm trying to make a simple macOS Cocoa application using NSStatusItem to create a clickable icon on the system status bar. However, when I launch my application, I get this warning and the icon doesn't show up:
2020-03-03 14:43:11.564…

Eric Reed
- 377
- 1
- 6
- 21
0
votes
1 answer
How to give an NSPopover focus when NSStatusItem is clicked?
I am building a macOS menubar app in Swift, using an NSStatusItem, which opens an NSPopover when the NSStatusItem's button is clicked.
How can I also give the NSPopover focus? Currently, the user needs to click on the popover to focus it, but I want…

j b
- 5,147
- 5
- 41
- 60
0
votes
1 answer
Detect when a NSStatusItem has been removed via drag and drop
One can set a NSStatusItem's behaviour property to removalAllowed (NSStatusItemBehaviorRemovalAllowed)
Then a user can remove the item from the status bar using drag and drop.
Example: removing the WiFi status item from the status bar
However, I…

Daniel
- 1,473
- 3
- 33
- 63
0
votes
1 answer
How to update a NSStausItem from another file?
I want to update the button.title property of a NSStausItem in the status bar, when the user klicks a button in my settings view. However, the NSStatusItem currently does not change.
AppDelegate:
let statusItem =…

hri
- 67
- 7
0
votes
0 answers
Setting title to custom view for status item cocoa
I've have custom status view which i have set to status item view property.
- (id)initWithStatusItem:(NSStatusItem *)statusItem
{
CGFloat itemWidth = [statusItem length];
CGFloat itemHeight = [[NSStatusBar systemStatusBar] thickness];
…

zack
- 137
- 12