Can I determine if the user disallowed my menubar item?

My app already has UI that allows the user to show/hide a menubar icon. If the user disallows my app's icon via System Settings > Menu Bar > Allow in the menu bar, I'd like to customize my own UI to reflect that. Does macOS provide a way for me to determine the "Allow in the menu bar" state for my application?

Answered by DTS Engineer in 844384022

I asked about this internally and learnt something new (-: The answer to your direct question:

Does macOS provide a way for me to determine the "Allow in the menu bar" state for my application?

is “No.” So far, so expected!

However, NSStatusItem supports a removalAllowed property. Once you set that the user can remove your status item without need of this System Settings control. Your app can observe the removal using KVO, as called out in the docs.

I’ve not had a chance to try this myself yet, but it seems like a good path forward.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I asked about this internally and learnt something new (-: The answer to your direct question:

Does macOS provide a way for me to determine the "Allow in the menu bar" state for my application?

is “No.” So far, so expected!

However, NSStatusItem supports a removalAllowed property. Once you set that the user can remove your status item without need of this System Settings control. Your app can observe the removal using KVO, as called out in the docs.

I’ve not had a chance to try this myself yet, but it seems like a good path forward.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Can I determine if the user disallowed my menubar item?
 
 
Q