Questions tagged [nsstatusbar]

The NSStatusBar class defines an object that manages a collection of NSStatusItem objects displayed within the system-wide menu bar.

The NSStatusBar class defines an object that manages a collection of NSStatusItem objects displayed within the system-wide menu bar. A status item can be displayed with text or an icon, can provide a menu and a target-action message when clicked, or can be a fully customized view that you create.

Use status items sparingly and only if the alternatives (such as a Dock menu, preference pane, or status window) are not suitable. Because there is limited space in which to display status items, status items are not guaranteed to be available at all times. For this reason, do not rely on them being available and always provide a user preference for hiding your application’s status items to free up space in the menu bar.

94 questions
29
votes
2 answers

How to access the system selected menu item blue color?

I'm working on an app that has a custom NSView on a NSStatusBar which performs all of the drawing when the user clicks it. But here's the problem, the color I'm currently drawing as the view's background color is not the same as the system blue…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
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
18
votes
2 answers

NSPopover transiency when popover is in status bar

I'm making an app which lives in status bar. When status item is clicked, NSPopover pops up. It looks like this: Here's the problem: I want it to be "transient", that is if I click anywhere outside of the popover, it will close. And while…
radex
  • 6,336
  • 4
  • 30
  • 39
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
11
votes
2 answers

NSStatusItem appears briefly on launch, but promptly disappears

I'm starting to get back into Cocoa development after not working on anything for a few months. Originally when I started I was using Snow Leopard and Xcode 3. I'm now running Lion with Xcode 4.2 and I'm running into some issues that I hadn't run…
Brandon Cordell
  • 1,308
  • 1
  • 9
  • 24
10
votes
3 answers

How to drag NSStatusItems

You all know the menu bar (or better said NSStatusBar) in Mac OS X. There are some items which I can move and other which not. I would like to be able to drag the NSStatusItem of my app. Any idea how to implement this?
papr
  • 4,717
  • 5
  • 30
  • 38
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
3 answers

How to update NSMenu while it's open?

I have a NSMenu with dynamically added NSMenuItems. The NSMenu is not refreshing properly while it's kept open. I am calling NSMenu update method in NSEventTrackingRunLoopModes. I have implemented following methods to update NSMenu. -…
Vinpai
  • 1,689
  • 3
  • 16
  • 18
8
votes
2 answers

How to open a NSPopover at a distance from the system bar?

I'm opening a NSPopover with the action of an icon in the status bar. myPopover.show(relativeTo: button.bounds, of: button, preferredEdge: NSRectEdge.minY) This works fine with the exception that the distance from the popover and the system bar is…
Pier
  • 10,298
  • 17
  • 67
  • 113
8
votes
3 answers

Mavericks and NSStatusItem's custom view with multiple monitors

Since Mavericks each screen has its own status bar. This also means that an application running in the status bar (using NSStatusItem) theoretically has multiple NSStatusItem objects associated. In practice, although the user might see multiple…
Niels Mouthaan
  • 1,010
  • 8
  • 19
7
votes
1 answer

How to pass statusBar to contentView in popover in SwiftUI app lifecycle?

I am trying to create a menubar app with the SwiftUI app lifecycle introduced in SwiftUI 2.0 (app struct) where buttons and actions from within the SwiftUI code would update the text of the status bar item. I am creating a status bar item which will…
7
votes
3 answers

Call Action when NSStatusBarButton is right-clicked

I am searching for a way to detect whenever the NSStatusBarButton is right-clicked (using Swift) and call an action. I am currently setting it up this way: let statusItem = NSStatusBar.systemStatusBar().statusItemWithLength(-1) func…
Devapploper
  • 6,062
  • 3
  • 20
  • 41
5
votes
2 answers

OSX: How to "unhide" a status bar item?

Ok I have a status menu application with a "Hide" menu item in it. Clicking on "Hide" calls: [[NSStatusBar systemStatusBar] removeStatusItem:statusItem] which of course removes my application from the status bar even though it is still running. I…
hollow7
  • 1,506
  • 1
  • 12
  • 20
5
votes
1 answer

NSStatusItem in NSStatusBar, action selector method not responding

First I declare the status item: var status_item: NSStatusItem? Then I have a function to close the widow and add the status item: self.view.window?.orderOut(self) //self.view.window?.close() self.status_item =…
Heestand XYZ
  • 1,993
  • 3
  • 19
  • 40
5
votes
2 answers

Detect left and right click events on NSStatusItem (Swift)

I’m building a status bar app and want to call different actions depending on if the user clicked left or right. Here’s what I have so far: var statusItem = NSStatusBar.system().statusItem(withLength: -1) statusItem.action =…
ixany
  • 5,433
  • 9
  • 41
  • 65
1
2 3 4 5 6 7