This commit is contained in:
Krishan 2024-07-25 09:56:56 +10:00
parent f36934a796
commit 13c29ef98e
3 changed files with 1 additions and 20 deletions

View file

@ -18,7 +18,6 @@ tauri-build = { version = "1.5.3", features = [] }
serde_json = "1.0.109"
serde = { version = "1.0.193", features = ["derive"] }
tauri = { version = "1.6.8", features = ["api-all", "devtools", "system-tray", "updater"] }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
[features]
# by default Tauri runs in production mode

View file

@ -3,7 +3,6 @@
windows_subsystem = "windows"
)]
use tauri::Manager;
#[cfg(target_os = "macos")]
mod menu;
mod tray;
@ -19,23 +18,6 @@ fn main() {
.on_system_tray_event(tray::system_tray_handler);
builder
.plugin(tauri_plugin_single_instance::init(|app, _, _| {
let tray_handle = match app.tray_handle_by_id(crate::tray::TRAY_LABEL) {
Some(h) => h,
None => return,
};
let window = app.get_window("main").unwrap();
if !window.is_visible().unwrap() || window.is_minimized().unwrap() {
window.unminimize().unwrap();
window.show().unwrap();
window.set_focus().unwrap();
tray_handle
.get_item("toggle")
.set_title("Hide Cinny")
.unwrap();
}
}))
.build(tauri::generate_context!())
.expect("error while building tauri application")
.run(run_event_handler)

View file

@ -3,7 +3,7 @@ use tauri::{
SystemTrayMenuItem, WindowEvent, SystemTrayHandle, Window,
};
pub const TRAY_LABEL: &'static str = "main-tray";
const TRAY_LABEL: &'static str = "main-tray";
pub fn window_event_handler<R: tauri::Runtime>(
app: &tauri::AppHandle<R>,