Wednesday, June 18, 2025

Showing Settings From macOS Menu Bar Items

Peter Steinberger (Mastodon):

SwiftUI provides SettingsLink for opening settings[…] Simple, right? Except it doesn’t work reliably in MenuBarExtra. The documentation doesn’t mention this limitation.

[…]

The root issue is that NSApplication treats menu bar apps as background utilities, not foreground applications. This affects how windows are ordered and receive events.

[…]

Apple provides an openSettings environment action for programmatic access (available since macOS 14.0+)[…] This currently works on macOS 15, but doesn’t work on macOS Tahoe (26). The logic needs an existing SwiftUI render tree, and simply calling the environment variable does nothing if none is found.

[…]

This shouldn’t be so hard. Opening a settings window is one of the most basic operations any app needs to perform. The fact that it requires hidden windows, activation policy juggling, and precise timing delays in 2025 is a testament to how menu bar apps remain second-class citizens in SwiftUI.

Brian Webster:

Anyone who’s done any amount of SwiftUI on the Mac would not be at all surprised at the amount of hoops required to jump through for things that seem like they should be quite simple.

Previously:

Comments RSS · Twitter · Mastodon

Leave a Comment