add idle timeout and version on settings screen

This commit is contained in:
2024-01-31 13:14:08 -08:00
parent 69f6a39396
commit 141334f7e2
9 changed files with 149 additions and 17 deletions

View File

@ -1,12 +1,15 @@
use tauri::{
AppHandle,
CustomMenuItem,
Manager,
SystemTray,
SystemTrayEvent,
SystemTrayMenu,
CustomMenuItem,
async_runtime as rt,
};
use crate::app;
use crate::state::AppState;
pub fn create() -> SystemTray {
@ -21,13 +24,18 @@ pub fn create() -> SystemTray {
}
pub fn handle_event(app: &AppHandle, event: SystemTrayEvent) {
pub fn handle_event(app_handle: &AppHandle, event: SystemTrayEvent) {
match event {
SystemTrayEvent::MenuItemClick{ id, .. } => {
match id.as_str() {
"exit" => app.exit(0),
"exit" => app_handle.exit(0),
"show_hide" => {
let _ = app::toggle_main_window(app);
let _ = app::toggle_main_window(app_handle);
let new_handle = app_handle.app_handle();
rt::spawn(async move {
let state = new_handle.state::<AppState>();
state.signal_activity().await;
});
}
_ => (),
}