change tray menu text when toggling visibility
This commit is contained in:
@ -1,15 +1,16 @@
|
||||
use tauri::{
|
||||
AppHandle,
|
||||
Manager,
|
||||
SystemTray,
|
||||
SystemTrayEvent,
|
||||
SystemTrayMenu,
|
||||
CustomMenuItem,
|
||||
};
|
||||
|
||||
use crate::app;
|
||||
|
||||
|
||||
pub fn create() -> SystemTray {
|
||||
let show = CustomMenuItem::new("show".to_string(), "Show");
|
||||
let show = CustomMenuItem::new("show_hide".to_string(), "Show");
|
||||
let quit = CustomMenuItem::new("exit".to_string(), "Exit");
|
||||
|
||||
let menu = SystemTrayMenu::new()
|
||||
@ -25,8 +26,8 @@ pub fn handle_event(app: &AppHandle, event: SystemTrayEvent) {
|
||||
SystemTrayEvent::MenuItemClick{ id, .. } => {
|
||||
match id.as_str() {
|
||||
"exit" => app.exit(0),
|
||||
"show" => {
|
||||
let _ = app.get_window("main").map(|w| w.show());
|
||||
"show_hide" => {
|
||||
let _ = app::toggle_main_window(app);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
Reference in New Issue
Block a user