fix: disable Linux desktop notifications to avoid tokio runtime panic

This commit is contained in:
thibaud-lclr 2026-04-21 17:37:49 +02:00
parent 18d26d7431
commit e0b09e4c29
2 changed files with 20 additions and 3 deletions

View file

@ -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)?;

View file

@ -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) {