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
2
votes
1 answer

How do I use isAlternative with an NSMenuItem with a customView?

I'm attempting to use the isAlternative property with an NSMenuItem with a custom view. It is not behaving as a standard NSMenuItem without a custom view. How do I get the standard modifier-key toggling behavior when using NSMenuItems with custom…
Ian Gordon
  • 41
  • 3
2
votes
2 answers

Remove pale-effect on NSStatusBarButton

I'm looking for a way to remove the pale effect from the NSStatusBarButton. This is a picture of how it currently looks: This is how it should look: After looking at Apple's documentation, I found a solution to the problem. If you set the…
Suboptimierer
  • 554
  • 4
  • 11
2
votes
1 answer

Replacing NSStatusBarButton NSView to disable vibrancy

I am currently trying to reduce the default vibrancy that is added to NSStatusBarItems icons in Mac OS. I understand this can be achieved by changing the allowsVibrancy attribute. However, since that is read-only on NSView, I need to extend that…
user1391281
  • 215
  • 1
  • 3
  • 10
2
votes
2 answers

Xcode NSStatusBar Item not appearing

I'm trying to add an item to the status bar, but when I launch the app the item only appears in the top left for a split second and then quickly disappears. I've looked through the documentation and I can see things have changed recently e.g.…
Jack Vanderpump
  • 216
  • 2
  • 16
2
votes
1 answer

MacOS create a ProgressBar on StatusBar

I'm looking for a way to put a ProgressBar onto the Mac status bar as a button. I want to have something like this: or What I can do is this: let statusItem = NSStatusBar.system.statusItem(withLength:NSStatusItem.variableLength) [...] …
Cemal K
  • 96
  • 8
2
votes
1 answer

Redirect button action to another function in Swift

This might be an easy question, but I am new to Swift and do not know for which terms to google for. For a menu bar application, I have implemented a custom function called doSomething that works just fine when it is bound to some button: Class…
klopps
  • 85
  • 5
2
votes
0 answers

NSSatusItem gets hidden if Application menu to large

Possible Duplicate: Being apprised of when NSStatusItem is hidden I'm currently working on a small Mac OS X app, that displays text in the status bar. I'm using a NSStatusItem with variable length if that helps. The problem I'm seeing is, that…
Björn Kaiser
  • 9,882
  • 4
  • 37
  • 57
1
vote
1 answer

NSMenuBar mouse down notification?

i'm trying to find notification/way to check if NSStatusItem from NSStatusBar (System wide bar) was clicked. Does anybody knows how to achive this ? Thanks EDITED 20120111 I meant "any" item from whole status bar.
xyz
  • 2,277
  • 2
  • 25
  • 41
1
vote
1 answer

Cocoa: get position of an NSStatusBar item

How can I get the position or frame of an NSStatusBar item?
SOMEONE
  • 5
  • 1
  • 2
1
vote
1 answer

NSStatusBar hidden in Mac OS X Lion

I'm currently developing a status bar application. It's quite important to know if the status bar is hidden because an application entered the full screen mode. Is there a way to know that? Thanks in advance.
lbrndnr
  • 3,361
  • 2
  • 24
  • 34
1
vote
2 answers

Swift - How does one animate (pulse between opacity 0 and 1) a NSImage in the menu bar?

I'm new at Swift and I can't seem to find any resource for what I'm trying to achieve. Most of what I find applies only to views. I have a statusBarItem: statusBarItem = NSStatusBar.system.statusItem(withLength:…
Maxime Dupré
  • 5,319
  • 7
  • 38
  • 72
1
vote
1 answer

How to add a button to a NSMenu that is used as Status bar menu?

I am using following code to create a statusbar menu for my app on MacOS: let statusBarItem = NSStatusBar.system.statusItem(withLength: -1) func applicationDidFinishLaunching(_ aNotification: Notification) { let menu: NSMenu = NSMenu() …
user688262
  • 171
  • 11
1
vote
1 answer

Popup Window for StatusBar Item

I'm building an Application and it needs to have a status bar item and a custom popup window, that popups when the status bar item is clicked. I know how to set up a status bar item and a nsmenu for it, but I need a custom window rather than a…
Chris
  • 117
  • 1
  • 5
1
vote
1 answer

Swift | MacOS | Update var with new NSPasteboard content on ChangeCount

I'm attempting to learn Swift in my spare time and have embarked on a mini-project to try and learn with purpose. I'm trying to create a MacOS app that shows the first 10 characters of the clipboard on the menu bar. I've had some success, I've…
morgyface
  • 368
  • 1
  • 9
1
vote
1 answer

How to draw custom view in NSStatusBar?

I currently have a NSStatusBar with a NSStatusBarItem with a title displaying. But I wan't to replace the title/text with a custom NSView. How can I do that? I currently have: func applicationDidFinishLaunching(_ aNotification: Notification) { …
eivindml
  • 2,197
  • 7
  • 36
  • 68