From e0b09e4c29c71b0f49729e017a72848e833b40fb Mon Sep 17 00:00:00 2001 From: thibaud-lclr Date: Tue, 21 Apr 2026 17:37:49 +0200 Subject: [PATCH] fix: disable Linux desktop notifications to avoid tokio runtime panic --- src-tauri/src/lib.rs | 9 ++++++--- src/components/layout/NotificationCenter.tsx | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 7517569..478df5c 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -17,9 +17,12 @@ pub struct AppState { #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { - tauri::Builder::default() - .plugin(tauri_plugin_dialog::init()) - .plugin(tauri_plugin_notification::init()) + let builder = tauri::Builder::default().plugin(tauri_plugin_dialog::init()); + + #[cfg(not(target_os = "linux"))] + let builder = builder.plugin(tauri_plugin_notification::init()); + + builder .setup(|app| { let db_dir = app.path().app_data_dir()?; std::fs::create_dir_all(&db_dir)?; diff --git a/src/components/layout/NotificationCenter.tsx b/src/components/layout/NotificationCenter.tsx index c2e7b17..3ecdf70 100644 --- a/src/components/layout/NotificationCenter.tsx +++ b/src/components/layout/NotificationCenter.tsx @@ -18,7 +18,21 @@ type NewNotificationEvent = { notification: OrchaiNotification; }; +function shouldSkipSystemNotification(): boolean { + if (typeof navigator === "undefined") { + return true; + } + + // Workaround: tauri-plugin-notification on Linux can panic in Tokio runtime + // (notify-rust/zbus `block_on` inside async runtime). Keep in-app notifications only. + return navigator.userAgent.toLowerCase().includes("linux"); +} + async function showSystemNotification(notification: OrchaiNotification) { + if (shouldSkipSystemNotification()) { + return; + } + try { let permissionGranted = await isPermissionGranted(); if (!permissionGranted) {