Fix macOS quit: intercept applicationShouldTerminate: to allow real exit

GLFW's applicationShouldTerminate: converts all quit paths (Cmd+Q, dock,
menu bar) into window close requests and returns NSTerminateCancel, so our
close-to-hide intercept was hiding the window instead of letting the app exit.

Fix by implementing applicationShouldTerminate: in ReopenDelegate, setting a
darwinQuitting flag before forwarding to GLFW's delegate. The close intercept
checks this flag and calls Window.Close() instead of Hide() when quitting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Drew Weymouth
2026-03-30 17:57:20 -07:00
co-authored by Claude Sonnet 4.6
parent 9a30559343
commit d43e0c126b
4 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -185,7 +185,7 @@ func NewMainWindow(fyneApp fyne.App, appName, displayAppName, appVersion string,
m.Window.SetCloseIntercept(func() {
m.SaveWindowSettings()
if runtime.GOOS == "darwin" || (app.Config.Application.CloseToSystemTray && m.HaveSystemTray()) {
if (runtime.GOOS == "darwin" && !isRealQuit()) || (app.Config.Application.CloseToSystemTray && m.HaveSystemTray()) {
m.Window.Hide()
} else {
m.Window.Close()