@@ -147,7 +147,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
147147 }
148148
149149 func applicationShouldHandleReopen( _: NSApplication , hasVisibleWindows _: Bool ) -> Bool {
150- if !state. skipHiddenIconAlert, let menuBar, !menuBar. menuBarExtra. isVisible {
150+ if !state. skipHiddenIconAlert,
151+ let menuBar,
152+ !menuBar. menuBarExtra. isVisible
153+ {
151154 displayIconHiddenAlert ( )
152155 }
153156 return true
@@ -173,15 +176,34 @@ class AppDelegate: NSObject, NSApplicationDelegate {
173176 let alert = NSAlert ( )
174177 alert. alertStyle = . informational
175178 alert. messageText = " Coder Desktop is hidden! "
176- alert. informativeText = """
177- Coder Desktop is running, but there's no space in the menu bar for it's icon.
178- You can rearrange icons by holding command.
179- """
179+ if #available( macOS 26 , * ) {
180+ alert. informativeText = """
181+ Coder Desktop is already running, but its menu bar item may be disabled, or hidden due to a lack of space.
182+ You can rearrange icons by holding command.
183+ """
184+ alert. addButton ( withTitle: " Open Menu Bar Settings " )
185+ } else {
186+ alert. informativeText = """
187+ Coder Desktop is already running, but there's no space in the menu bar for its icon.
188+ """
189+ }
190+
191+ let suppressCheckbox = NSButton ( checkboxWithTitle: " Don't show again " , target: nil , action: nil )
192+ suppressCheckbox. state = state. skipHiddenIconAlert ? . on : . off
193+ alert. accessoryView = suppressCheckbox
194+
180195 alert. addButton ( withTitle: " OK " )
181- alert. addButton ( withTitle: " Don't show again " )
182- let resp = alert. runModal ( )
183- if resp == . alertSecondButtonReturn {
184- state. skipHiddenIconAlert = true
196+ let response = alert. runModal ( )
197+ state. skipHiddenIconAlert = suppressCheckbox. state == . on
198+ if #available( macOS 26 , * ) , response == . alertFirstButtonReturn {
199+ // We'll need to ensure this continues to work in future macOS versions
200+ if !NSWorkspace. shared. open (
201+ URL ( string: " x-apple.systempreferences:com.apple.ControlCenter-Settings.extension?MenuBar " ) !
202+ ) {
203+ NSWorkspace . shared. open (
204+ URL ( string: " x-apple.systempreferences:com.apple.ControlCenter-Settings.extension " ) !
205+ )
206+ }
185207 }
186208 }
187209}
0 commit comments