From 6a82c906de337b1225781e2bcc5e74c8d43fbf34 Mon Sep 17 00:00:00 2001 From: tomdebone Date: Tue, 7 Jul 2026 18:57:45 +0200 Subject: [PATCH] tauri-app: tray settings menu item Tray menu now includes a Settings entry that emits 'app://navigate' with payload 'settings', mirroring home/profile/search. client.ts listenTrayEvents type extended to include 'settings'. --- crates/tauri-app/src-tauri/src/lib.rs | 12 ++++++++++++ crates/tauri-app/src/lib/api/client.ts | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/tauri-app/src-tauri/src/lib.rs b/crates/tauri-app/src-tauri/src/lib.rs index 6ea79d4..de6c150 100644 --- a/crates/tauri-app/src-tauri/src/lib.rs +++ b/crates/tauri-app/src-tauri/src/lib.rs @@ -606,6 +606,14 @@ pub fn run() { None::<&str>, ) .map_err(|e| format!("failed to build search menu item: {e}"))?; + let settings_item = tauri::menu::MenuItem::with_id( + app, + "tray_settings", + "Settings", + true, + None::<&str>, + ) + .map_err(|e| format!("failed to build settings menu item: {e}"))?; let quit_item = tauri::menu::MenuItem::with_id( app, "tray_quit", @@ -625,6 +633,7 @@ pub fn run() { &compose_item, &profile_item, &search_item, + &settings_item, &separator, &quit_item, ], @@ -653,6 +662,9 @@ pub fn run() { "tray_search" => { let _ = tauri::Emitter::emit(app, "app://navigate", "search"); } + "tray_settings" => { + let _ = tauri::Emitter::emit(app, "app://navigate", "settings"); + } "tray_quit" => { app.exit(0); } diff --git a/crates/tauri-app/src/lib/api/client.ts b/crates/tauri-app/src/lib/api/client.ts index bbc8032..09a011a 100644 --- a/crates/tauri-app/src/lib/api/client.ts +++ b/crates/tauri-app/src/lib/api/client.ts @@ -355,13 +355,13 @@ export async function showNotification( /// The handler receives the event payload (empty object for these /// cases). Returns an unsubscribe function. export async function listenTrayEvents( - handler: (event: "show" | "home" | "compose" | "profile" | "search") => void, + handler: (event: "show" | "home" | "compose" | "profile" | "search" | "settings") => void, ): Promise<() => void> { const { listen } = await import("@tauri-apps/api/event"); const unlisteners: Array<() => void> = []; const u1 = await listen("app://show", () => handler("show")); const u2 = await listen("app://navigate", (e) => { - handler(e.payload as "home" | "profile" | "search"); + handler(e.payload as "home" | "profile" | "search" | "settings"); }); const u3 = await listen("app://compose", () => handler("compose")); unlisteners.push(u1, u2, u3);