You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Cap remains active in macOS App Switcher (Cmd+Tab) after closing Main Window with 'X' #1859
I noticed an issue with how Cap handles its window lifecycle and application state on macOS, which heavily disrupts the daily workflow when switching between applications.
The Bug:
Cap functions beautifully as a Menubar utility. However, when I click "Open Main Window" from the Menubar dropdown and then subsequently close this main control panel using the red "X" button in the top-left corner, the window disappears, but Cap remains trapped in an ambiguous state.
The Problem: Even though there is no active window on my screen, Cap still appears as an active application inside the macOS Dock and, more importantly, inside the macOS App Switcher (Cmd + Tab / Alt-Tab).
When I use Cmd + Tab to cycle through my open applications, I land on Cap, but it focuses nothing because the window was closed. I have to click into another app to make the Menubar focus shift away from Cap.
Proposed Solution:
Please modify the window-close behavior. When the Main Window is closed via the "X" button, the application should dynamically adjust its activation policy (NSApplication.ActivationPolicy) to act strictly as a background/menubar agent (.accessory). It should completely disappear from the Dock and the Cmd + Tab App Switcher until explicitly opened again from the Menubar.
Greetings, Denny
Looking at the codebase, the dock/app-switcher visibility is managed in apps/desktop/src-tauri/src/permissions.rs via sync_macos_dock_visibility() (around lines 177-210). This function is called on WindowEvent::Destroyed in lib.rs:4833.
The current behavior is intentional based on the hide_dock_icon setting in General Settings (general_settings.rs:132). When this setting is disabled (the default), Cap keeps the dock icon visible even when no windows are open. The activation policy only switches to .accessory when hide_dock_icon is enabled AND no dock-activating windows are visible.
permissions.rs: sync_macos_dock_visibility() controls the policy toggle
windows.rs:825-836: activates_dock() defines which windows trigger dock sync (Main, Editor, ScreenshotEditor, Settings, Upgrade, ModeSelect, Onboarding)
lib.rs:4660-4706: Main window destruction cleanup (doesn't explicitly call dock sync, relies on the generic handler at line 4833)
The behavior you're describing would require either:
Enabling the existing "Hide dock icon" setting in General Settings, or
Changing the default behavior so Cap always acts as a menubar-only app when the Main Window is closed
Given the recent dock-related fixes in PR #1849, any changes here should be careful not to reintroduce the duplicate dock icon race conditions that were just resolved.
@dennyschroeder@richiemcilroy, a setting already exists for this, disabling "Always show dock icon" in Settings removes Cap from the dock and app switcher when no windows are open.
The problem was the sync never fired when the main window was closed, so the setting had no effect, this PR #1865 fixes that. Thanks
Wow, that was incredibly fast! Thank you so much for the lightning-fast fix and for confirming the bug. Can't wait for the next release to test it out. You guys are awesome! 🚀🙌
Activity
linear commentedon May 21, 2026
CAP-720
tembo commentedon May 21, 2026
Looking at the codebase, the dock/app-switcher visibility is managed in
apps/desktop/src-tauri/src/permissions.rsviasync_macos_dock_visibility()(around lines 177-210). This function is called onWindowEvent::Destroyedinlib.rs:4833.The current behavior is intentional based on the
hide_dock_iconsetting in General Settings (general_settings.rs:132). When this setting is disabled (the default), Cap keeps the dock icon visible even when no windows are open. The activation policy only switches to.accessorywhenhide_dock_iconis enabled AND no dock-activating windows are visible.Related context:
set_activation_policy(Accessory)callsKey code locations:
permissions.rs:sync_macos_dock_visibility()controls the policy togglewindows.rs:825-836:activates_dock()defines which windows trigger dock sync (Main, Editor, ScreenshotEditor, Settings, Upgrade, ModeSelect, Onboarding)lib.rs:4660-4706: Main window destruction cleanup (doesn't explicitly call dock sync, relies on the generic handler at line 4833)The behavior you're describing would require either:
Given the recent dock-related fixes in PR #1849, any changes here should be careful not to reintroduce the duplicate dock icon race conditions that were just resolved.
dennyschroeder commentedon May 21, 2026
ManthanNimodiya commentedon May 21, 2026
@dennyschroeder @richiemcilroy, a setting already exists for this, disabling "Always show dock icon" in Settings removes Cap from the dock and app switcher when no windows are open.
The problem was the sync never fired when the main window was closed, so the setting had no effect, this PR #1865 fixes that. Thanks
dennyschroeder commentedon May 22, 2026
Wow, that was incredibly fast! Thank you so much for the lightning-fast fix and for confirming the bug. Can't wait for the next release to test it out. You guys are awesome! 🚀🙌
ManthanNimodiya commentedon May 22, 2026
@dennyschroeder , glad we could get to it quickly.
Reports like yours make it much easier to track and fix, keep them coming