Skip to content

fix(macos): remove redundant activation policy toggle causing duplicate dock icons#1849

Open
ManthanNimodiya wants to merge 2 commits into
CapSoftware:mainfrom
ManthanNimodiya:fix/macos-duplicate-dock-icons
Open

fix(macos): remove redundant activation policy toggle causing duplicate dock icons#1849
ManthanNimodiya wants to merge 2 commits into
CapSoftware:mainfrom
ManthanNimodiya:fix/macos-duplicate-dock-icons

Conversation

@ManthanNimodiya
Copy link
Copy Markdown
Contributor

@ManthanNimodiya ManthanNimodiya commented May 20, 2026

What does this PR fix?

Fixes the bug where multiple Cap app icons appear in the macOS Dock when starting a recording.

Root cause

prepare_macos_panel_window eagerly called set_activation_policy(Accessory) on every panel window creation. During recording start, multiple panel windows are created in sequence, causing rapid Accessory → Regular policy toggling that confuses macOS Dock into registering duplicate app tiles.

Fix

Removed the eager set_activation_policy(Accessory) call — the existing MACOS_PENDING_PANEL_WINDOWS counter already blocks the dock sync from firing during panel creation, making it redundant.

Changes

  • apps/desktop/src-tauri/src/permissions.rs: removed 4 lines from prepare_macos_panel_window

Greptile Summary

This PR removes four lines from prepare_macos_panel_window that called set_activation_policy(Accessory) on every panel window creation, which caused rapid policy toggling and duplicate Dock entries during recording start.

  • The MACOS_PENDING_PANEL_WINDOWS counter already prevents sync_macos_dock_visibility from firing while any panel guard is live (line 172–174), so the eager Accessory call was effectively redundant — but with the side effect of triggering macOS Dock re-registration each time.
  • The fix is minimal and correctly scoped; dock visibility is still applied at the right time via MacosPanelWindowActivationGuard::dropschedule_macos_dock_visibility_syncsync_macos_dock_visibility.

Confidence Score: 5/5

Safe to merge — removes a provably redundant macOS API call that was the direct cause of the reported bug without altering any other code path.

The deleted call to set_activation_policy(Accessory) served no purpose beyond the counter-gated sync_macos_dock_visibility path that already handles policy when all panel guards are released. Removing it eliminates the harmful rapid toggling with no observable regression risk.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src-tauri/src/permissions.rs Removes the eager set_activation_policy(Accessory) call from prepare_macos_panel_window; the existing MACOS_PENDING_PANEL_WINDOWS counter already gates dock-visibility syncs, making the call redundant and harmful.

Reviews (1): Last reviewed commit: "fix(macos): remove redundant activation ..." | Re-trigger Greptile

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. labels May 20, 2026
@ManthanNimodiya
Copy link
Copy Markdown
Contributor Author

@richiemcilroy, got a new approach -> set Accessory once when the first panel window is created, and never restore Regular while panel windows are still visible.
What do you think is it good or I missed something?

@richiemcilroy
Copy link
Copy Markdown
Member

I guess we just need to try it and see if the behaviour of the main window and camera window showing above a fullscreen app is preserved

@ManthanNimodiya
Copy link
Copy Markdown
Contributor Author

ManthanNimodiya commented May 21, 2026

@richiemcilroy, ok I will try with this approach and let you know at the earliest does that work fine?

@ManthanNimodiya ManthanNimodiya force-pushed the fix/macos-duplicate-dock-icons branch from 2436b25 to c00cefa Compare May 21, 2026 01:07
@ManthanNimodiya
Copy link
Copy Markdown
Contributor Author

@richiemcilroy, I ran it and noticed no issues, can you confirm on your side also and lmk for any issues, I applied the suggested approach

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

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants