In macOS 26 I noticed there is a section Menu Bar in System Settings which allows to toggle visibility of status items created with NSStatusItem
. I'm assuming this is new, since I never noticed it before.
Currently my app has a menu item that allows toggling its status item, but now I wonder whether it should always create the status item and let the user control its visibility from System Settings. Theoretically, keeping this option inside the app could lead to confusion if the user has previously disabled the status item in System Settings, then perhaps forgot about it, and then tries to enable it inside the app, but apparently nothing happens because System Settings overrides the app setting. Should I remove the option inside the app?
This also makes me think of login items, which can be managed both in System Settings and inside the app via SMAppService
. Some users ask why my app doesn't have a launch at login option, and I tell them that System Settings already offers that functionality. Since there is SMAppService
I could offer an option inside the app that is kept in sync with System Settings, but I prefer to avoid duplicating functionality, particularly if it's something that is changed once by the user and then rarely (if ever) changed afterwards. But I wonder: why can login items be controlled by an app, and the status item cannot (at least I'm not aware of an API that allows to change the option in System Settings)? If the status item can be overridden in System Settings, why do login items behave differently?
I tried before posting, but isVisible stays true even when disabling the status item in System Settings.
Hmmm. Please file a bug on that, as you should be able to detect your status.
But will the agent be listed in System Settings > General > Login Items?
No, it'll be shown immediately below in the section labeled "App Background Activity".
In my opinion, it would make more sense to use an option that is kept in sync between the app and System Settings.
Yes, and that's how this works. SMAppService.status returns the app’s current "state" in the preference UI.
Looking at how different privacy features are implemented in macOS, I would have expected that login items (or agents, or however we might call them) can be disabled in System Settings, without the app being able to turn them on again without the user noticing.
Yes, and that's how this works too. If your status is "SMAppServiceStatusRequiresApproval", then the user will need to activate the component themselves through the preference UI. Having said that, one thing to understand here is that app lifetime and process management is FAR less controlled on macOS than it is on iOS and probably always will be.
If not, then that could be another source of confusion, similar to the status item: the user can enable "launch at login" both in the app (which uses an agent) and in System Settings (which uses a login item), then later removes it from System Settings and wonders why it keeps being launched at login (because they forgot that they have to disable it in the app as well).
No, not really.
All of the SMAppService APIs are tied to objects "inside" your app bundle. The user could add your app to login items, but adding the login item INSIDE your app to the login item list is... trickier. It can be done, but the UI in System Settings won't navigate "inside" an app bundle. To add an item like this, you'd need to use "Show Package Contents" in the Finder to navigate to the item, then drop that item inside the interface. Certainly possible, but not something that's going to happen by accident.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware