Skip to content

Windows and Linux: no quit request; Quit, a tray's Quit and logout end the app without asking OnQuitRequest (from #86) #1082

Closed

Description

@houko

Context

Line numbers are at 296c3f5 (main). One of the two milestones #86 was closed to be split into; this is the Windows and Linux one. The macOS forced-quit milestone is filed separately.

Scope.OnQuitRequest runs "on macOS" only (core/quit.go:61, desktop/app.go:82); docs/public/en/testing.md:52 says a Quit menu item "quits at once on Windows and Linux". The Windows and Linux backends have no quit request:

  • Windows: the Quit menu role posts WM_CLOSE to the root window (internal/platform/windows/chrome.go:1029-1035), and ItemQuit ends the loop (internal/platform/windows/windows.go:1363); nothing dispatches EventQuitRequest. There is no handling of WM_QUERYENDSESSION/WM_ENDSESSION, so a logout or shutdown is not seen at all.
  • Linux: the Quit menu role closes the primary window (internal/platform/linux/input.go:1073-1078), ItemQuit closes the window (internal/platform/linux/linux.go:1016-1019), and there is no session-end handling (GTK's GApplication query-end, or the XDG session inhibit portal).
  • Closing the primary window (EventWindowClose, windows.go:2215, linux.go:751, :1374) asks OnClosing, which is a different question from quitting: a tray app may close its window and keep running.

#86's closing comment lists what has to be consistent: primary-window close and MenuQuit routing, Alt+F4, tray Quit, and native target tests.

Why it matters

An app that asks before quitting while it has unsaved work or a running job can only do so on macOS; on Windows and Linux its Quit item, its tray's Quit and a logout end it at once. Kando asks before a quit ends a running job, which on Windows and Linux it can do only from the Quit menu items whose OnSelect it handles itself; a tray's Quit or a logout ends the job without a word.

Proposal

  • Windows and Linux dispatch EventQuitRequest for the Quit menu role, ItemQuit from a tray menu, and the app's own desktop Quit, and quit only once the handlers approve, with Defer as on macOS.
  • Closing the primary window keeps going through OnClosing; when that close would end the app (no tray, no other window), it is then also a quit request, so Alt+F4 on the last window and Cmd+Q on macOS reach the same handlers.
  • A logout or shutdown is a forced quit (QuitRequest.Forced() from the macOS milestone): on Windows WM_QUERYENDSESSION answers TRUE and WM_ENDSESSION runs OnQuit within QuitTimeout; on Linux the session's end signal does the same. A forced quit cannot be cancelled.
  • The docs drop "on macOS" from OnQuitRequest, and nsgotest's headless Quit role asks the handlers on all three desktops.

Acceptance

  • On Windows and Linux, the Quit menu item, a tray menu's Quit and closing the last window (Alt+F4) run OnQuitRequest's handlers, and a handler can cancel or defer them.
  • Logout and shutdown run OnQuit and never wait for a handler's answer.
  • -target windows and -target linux tests cover a cancelled and an approved request.

Activity

  1. self-assigned this
    on Nov 21, 2026
  2. houko commented on Nov 22, 2026

    @houko
    CollaboratorAuthor

    Audit complete. The Windows and Linux quit-request scope shipped in PR #1197, which routes desktop and tray Quit through OnQuitRequest, handles deferred approval and forced session-end paths, and passed its focused Windows/Linux checks. The issue is already closed by that merged implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions