Fix the bug that the window position cannot be saved when the Linux/Windows status bar exits
This commit is contained in:
@@ -5,6 +5,9 @@ use tauri::{CustomMenuItem, Menu, Submenu, WindowMenuEvent};
|
|||||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||||
use tauri::{Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowUrl};
|
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 {
|
pub fn get_menu() -> Menu {
|
||||||
// first menu
|
// first menu
|
||||||
let hide = CustomMenuItem::new("hide", "Hide");
|
let hide = CustomMenuItem::new("hide", "Hide");
|
||||||
@@ -95,6 +98,8 @@ pub fn system_tray_handle(app: &tauri::AppHandle, event: SystemTrayEvent) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
"quit" => {
|
"quit" => {
|
||||||
|
let _res = app.save_window_state(StateFlags::all());
|
||||||
|
// println!("save windows state result {:?}", _res);
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
}
|
||||||
"about" => {
|
"about" => {
|
||||||
|
|||||||
Reference in New Issue
Block a user