diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 55cf527..751ff8f 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -9,7 +9,7 @@ use cache_manager::{CacheManager, CacheManagerState}; use media_control::MediaControlState; use rodio::OutputStream; use std::sync::{Arc, Condvar, Mutex, Once}; -use tauri::{Emitter, Manager}; +use tauri::{image::Image, Emitter, Manager}; use std::sync::atomic::AtomicBool; use tauri::{ menu::{MenuBuilder, MenuItemBuilder}, @@ -48,8 +48,11 @@ pub async fn run() { let pause_resume = MenuItemBuilder::with_id("pause_resume", "Pause/Resume").build(app)?; let quit = MenuItemBuilder::with_id("quit", "Quit").build(app)?; let menu = MenuBuilder::new(app).items(&[&show, &pause_resume, &quit]).build()?; - - let tray = TrayIconBuilder::new() + + let _tray = TrayIconBuilder::new() + .title("Cicadas") + .tooltip("Cicadas") + .icon(Image::from_path("./icons/32x32.png")?) // Set the icon using the resolved path .menu(&menu) .on_menu_event(move |app, event| { match event.id().as_ref() { @@ -83,9 +86,6 @@ pub async fn run() { }) .build(app)?; - tray.set_title(Some("Cicadas"))?; - tray.set_tooltip(Some("Cicadas"))?; - Ok(()) }) .on_window_event(|window, event| { diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 23ad97e..c2f4f32 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -41,6 +41,9 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ] + ], + "resources": { + "icons/32x32.png": "icons/" + } } } diff --git a/src/App.tsx b/src/App.tsx index 0876842..3009913 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -28,7 +28,9 @@ function App () { document.addEventListener('contextmenu', disableContextMenu); return () => { document.removeEventListener('contextmenu', disableContextMenu); - document.removeEventListener('keydown', disableRefresh); + if (import.meta.env.PROD) { + document.removeEventListener('keydown', disableRefresh); + } }; }, []); return (