diff --git a/src-tauri/src/system_notifications.rs b/src-tauri/src/system_notifications.rs index cc453658d8..6316b8a9de 100644 --- a/src-tauri/src/system_notifications.rs +++ b/src-tauri/src/system_notifications.rs @@ -3,7 +3,8 @@ //! Driven by `show_system_notification` from the notification store. Honour //! global `[notifications].systemNotifications`; suppressed while any window is //! active. Click focuses the window that raised the toast — balloon actions stay -//! in the IDE. +//! in the IDE. On macOS a click only activates the app: tracking clicks there costs +//! a waiting thread per toast. use parking_lot::Mutex; use std::collections::HashMap; @@ -55,6 +56,12 @@ pub fn init(app: &AppHandle) { if STATE.ready.swap(true, Ordering::AcqRel) { return; } + // macOS: with an action handler the plugin parks a thread per toast until it is clicked, + // so ignored toasts pile up threads and NSUserNotificationCenter CPU. A click on a toast + // already brings the app forward there, so leave the handler out. + if cfg!(target_os = "macos") { + return; + } let handle = app.clone(); if let Err(e) = app.notification().on_action(move |performed| { if performed.action_id() != "tap" {