fix(macos): sync dock visibility when main window is hidden on close#1865
Open
ManthanNimodiya wants to merge 1 commit into
Open
fix(macos): sync dock visibility when main window is hidden on close#1865ManthanNimodiya wants to merge 1 commit into
ManthanNimodiya wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR fix?
Fixes #1859,
Cap remains visible in the macOS Dock and App Switcher after closing the main window even when no windows are open.
Root cause
The
CloseRequestedhandler for the Main window callsapi.prevent_close()andwindow.hide()— the window is never destroyed.Since the
Destroyedevent is the only trigger for a dock visibility sync in this flow, no sync ever runs after Main is hidden.The activation policy stays
Regular, keeping Cap in the Dock and App Switcher indefinitely.Fix
Added a
schedule_macos_dock_visibility_synccall immediately afterwindow.hide()in the Main window close handler.This ensures the dock and app switcher state is correctly updated based on the user's 'Always show dock icon' setting.
Changes
apps/desktop/src-tauri/src/lib.rs: 3 lines added to Main CloseRequested handlerGreptile Summary
This PR fixes a macOS Dock/App Switcher visibility bug where Cap remained present in the Dock after the main window was hidden on close. Because the window is never destroyed (only hidden via
api.prevent_close()+window.hide()), the existingDestroyed-event-triggered sync never fired, leaving the activation policy stuck onRegular.#[cfg(target_os = \"macos\")] schedule_macos_dock_visibility_sync(app)call right afterwindow.hide()in theCapWindowId::Mainclose handler — exactly mirroring the pattern already used in several other places inwindows.rs.Confidence Score: 5/5
Safe to merge — the change is a minimal, targeted addition to a macOS-only code path that follows a well-established pattern already used throughout the codebase.
The three added lines call an existing, well-tested helper that is already invoked in four other window-event handlers. The helper's debounce mechanism means the new call cannot race with or duplicate existing syncs. No existing behaviour is altered on non-macOS builds.
No files require special attention.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(macos): sync dock visibility when ma..." | Re-trigger Greptile