1

I've been playing around with creating a Menu Bar app for macOS.

The app consists of an icon along with a title. The title displays additional context and can be dynamic width.

I've noticed that when the Menu Bar does not have enough room to display the icon AND context, it hides the whole app completely (icon and context) until there is space once again to show it.

Is it possible to prevent it from doing this somehow? Or at the very least maintain the icon visibility without the title, if room doesn't allow?

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
Simon
  • 2,065
  • 3
  • 21
  • 28
  • This question may be a duplicate or similar to another question about [detecting if nsstatusitem is displayed](https://stackoverflow.com/q/6868317). – Jerry Dec 16 '21 at 14:27

2 Answers2

0

Unfortunately no, NSStatusItem lacks methods to indicate visibility or occlusion. The functionality you want might be possible via notification, but that is up to Apple to implement.

Jerry
  • 966
  • 2
  • 13
  • 28
0

You may use two separate NSStatusItem. Looks like after creation they should be adjacent, until user reorders them with Cmd-drag.

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48