Skip to content

fix(desktop): terminate process on exit; quit on close when no tray#5858

Merged
jamesarich merged 1 commit into
mainfrom
claude/great-wing-9e2312
Jun 18, 2026
Merged

fix(desktop): terminate process on exit; quit on close when no tray#5858
jamesarich merged 1 commit into
mainfrom
claude/great-wing-9e2312

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

Closing the Meshtastic Desktop app left the process running with no window and no reliable way to quit. This restores normal exit behavior and adds a safety net for desktop environments that have no system tray.

Fixes #5857

🐛 Bug Fixes

  • Terminate the JVM on exit. main() passed exitProcessOnExit = false to application(). Compose Desktop relies on AWT, whose shutdown thread is non-daemon, so the JVM only exits when exitProcess(0) runs — which application() skips when that flag is false. As a result exitApplication() (tray Quit and Super/Cmd+Q) ended the composition but never killed the process. Removed the flag to restore the documented default (true). Per the application() KDoc, false is only for running code after the application{} block, which this expression-body main does not.
  • Quit on window-close when no tray exists. Window-close minimizes to the tray by design (so background mesh notifications keep arriving). On platforms without a system tray (e.g. some Linux desktop environments) there is nowhere to minimize to, which would strand a windowless, icon-less process. Window-close now falls back to exitApplication() when isTraySupported is false.

Resulting behavior:

Action Tray available No tray (e.g. some Linux DEs)
Window close (X) Minimize to tray Quit
Tray "Quit" / Super+Q Quit n/a

Where a tray exists, window-close still minimizes to it (unchanged); the tray Quit item and Super/Cmd+Q now genuinely terminate the process.

Verification

./gradlew :desktopApp:compileKotlin :desktopApp:spotlessCheck :desktopApp:detekt — all pass. The change is isolated to the desktop host shell (desktopApp/src/main/kotlin/org/meshtastic/desktop/Main.kt); no tests reference it and no other module depends on it, so the module-scoped checks are the complete relevant gate.

Closing the desktop app left the JVM running. main() passed
exitProcessOnExit = false to application(), so exitApplication() (tray
Quit / Super+Q) ended the composition but never called exitProcess(0).
Compose Desktop relies on AWT, whose non-daemon shutdown thread keeps the
JVM alive until exitProcess() runs, so the process never terminated.
Restore the default (true).

Also fall back to exitApplication() on window-close when no system tray is
available (e.g. some Linux DEs), so minimize-to-tray can't strand a
windowless, trayless process.

Fixes #5857

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the bugfix PR tag label Jun 18, 2026
@jamesarich jamesarich enabled auto-merge June 18, 2026 22:15
@jamesarich jamesarich added this pull request to the merge queue Jun 18, 2026
Merged via the queue into main with commit 0ab7a4d Jun 18, 2026
19 checks passed
@jamesarich jamesarich deleted the claude/great-wing-9e2312 branch June 18, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: desktop .deb process remain open on exit

1 participant