From fba5475b2d131f464ffeca219da8fddefdae0677 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Thu, 6 Apr 2023 20:59:23 +0800 Subject: [PATCH 1/2] Fix the problem that the status bar configuration does not take effect --- src-tauri/src/app/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/src/app/config.rs b/src-tauri/src/app/config.rs index 0119218..048e202 100644 --- a/src-tauri/src/app/config.rs +++ b/src-tauri/src/app/config.rs @@ -58,6 +58,6 @@ impl PakeConfig { #[cfg(not(target_os = "macos"))] pub fn show_system_tray(&self) -> bool { - self.menu.copied() + self.system_tray.copied() } } From 318f3cca4125021bd78e8a0284422c46fda02aca Mon Sep 17 00:00:00 2001 From: Tlntin Date: Thu, 6 Apr 2023 21:15:45 +0800 Subject: [PATCH 2/2] Fix the bug that the window position cannot be saved when the Linux/Windows status bar exits --- src-tauri/src/app/menu.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index e46753f..3db979c 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -5,6 +5,9 @@ use tauri::{CustomMenuItem, Menu, Submenu, WindowMenuEvent}; #[cfg(any(target_os = "linux", target_os = "windows"))] use tauri::{Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowUrl}; +#[cfg(any(target_os = "linux", target_os = "windows"))] +use tauri_plugin_window_state::{AppHandleExt, StateFlags}; + pub fn get_menu() -> Menu { // first menu let hide = CustomMenuItem::new("hide", "Hide"); @@ -95,6 +98,8 @@ pub fn system_tray_handle(app: &tauri::AppHandle, event: SystemTrayEvent) { .unwrap(); } "quit" => { + let _res = app.save_window_state(StateFlags::all()); + // println!("save windows state result {:?}", _res); std::process::exit(0); } "about" => {