Skip to content

Commit c00cefa

Browse files
fix(macos): prevent duplicate dock icons during recording start
1 parent f0695bd commit c00cefa

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

apps/desktop/src-tauri/src/permissions.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,13 @@ fn macos_sync_activation_policy(app: &tauri::AppHandle, should_show_dock: bool)
162162
pub(crate) fn prepare_macos_panel_window(
163163
app: &tauri::AppHandle,
164164
) -> MacosPanelWindowActivationGuard {
165-
MACOS_PENDING_PANEL_WINDOWS.fetch_add(1, Ordering::AcqRel);
165+
let prev = MACOS_PENDING_PANEL_WINDOWS.fetch_add(1, Ordering::AcqRel);
166+
167+
if prev == 0 {
168+
if let Err(err) = app.set_activation_policy(tauri::ActivationPolicy::Accessory) {
169+
tracing::warn!("Failed to prepare macOS panel activation policy: {err}");
170+
}
171+
}
166172

167173
MacosPanelWindowActivationGuard { app: app.clone() }
168174
}
@@ -173,6 +179,16 @@ pub(crate) fn sync_macos_dock_visibility(app: &tauri::AppHandle) {
173179
return;
174180
}
175181

182+
let has_visible_panel_window = app.webview_windows().iter().any(|(label, window)| {
183+
CapWindowId::from_str(label)
184+
.map(|id| !id.activates_dock() && window.is_visible().unwrap_or(false))
185+
.unwrap_or(false)
186+
});
187+
188+
if has_visible_panel_window {
189+
return;
190+
}
191+
176192
let should_hide_dock = GeneralSettingsStore::get(app)
177193
.ok()
178194
.flatten()

0 commit comments

Comments
 (0)