Skip to content

Fix macOS window lifecycle: close now hides reliably and tray hide no longer reopens - #10

Merged
proplayer919 merged 4 commits into
mainfrom
copilot/fix-macos-close-button
Aug 9, 2026
Merged

Fix macOS window lifecycle: close now hides reliably and tray hide no longer reopens#10
proplayer919 merged 4 commits into
mainfrom
copilot/fix-macos-close-button

Conversation

Copilot AI commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The companion app’s main window lifecycle on macOS was inconsistent: clicking the window close control did not properly dismiss the app window, and selecting Hide from the tray menu could immediately re-show it. This updates window/tray event handling to make hide behavior deterministic.

  • Window close handling (macOS-visible behavior)

    • Added a CloseRequested handler for the main window.
    • Close now prevents default teardown and hides the window instead, matching tray-style background behavior.
  • Tray interaction behavior

    • Removed unconditional tray icon event handling that forced the main window to show on tray events.
    • This prevents the hide action from being immediately negated by an auto-show path.
  • Scope intentionally limited

    • No menu bar asset or app icon asset changes were included in this PR (handled separately as requested).
.on_window_event(|window, event| {
    if window.label() == "main" {
        if let WindowEvent::CloseRequested { api, .. } = event {
            api.prevent_close();
            let _ = window.hide();
        }
    }
})

Co-authored-by: proplayer919 <95329795+proplayer919@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix app close button functionality on macOS Fix macOS window lifecycle: close now hides reliably and tray hide no longer reopens Aug 9, 2026
Copilot AI requested a review from proplayer919 August 9, 2026 02:39
@proplayer919
proplayer919 marked this pull request as ready for review August 9, 2026 04:27
Copilot AI lite review requested due to automatic review settings August 9, 2026 04:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Tauri companion app’s window/tray event handling so the main window can be reliably dismissed on macOS (close hides the window instead of tearing down) and tray “Hide” no longer triggers an immediate re-show.

Changes:

  • Added a WindowEvent::CloseRequested handler for the main window to prevent close and hide the window.
  • Removed unconditional tray icon event handling that always showed the main window, avoiding auto-reopen after hide.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread companion/src-tauri/src/lib.rs
proplayer919 and others added 2 commits August 9, 2026 14:32
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@proplayer919
proplayer919 merged commit 07f5f1f into main Aug 9, 2026
5 checks passed
@proplayer919
proplayer919 deleted the copilot/fix-macos-close-button branch August 9, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: App close button doesn't work on macOS and various issues

3 participants