()
| 72 | |
| 73 | #[cfg_attr(mobile, tauri::mobile_entry_point)] |
| 74 | pub fn run() { |
| 75 | // let quit = CustomMenuItem::new("quit".to_string(), "Quit"); |
| 76 | // let tray_menu = SystemTrayMenu::new() |
| 77 | // .add_item(quit) |
| 78 | // .add_native_item(SystemTrayMenuItem::Separator) |
| 79 | // .add_item(CustomMenuItem::new("hello".to_string(), "Hello")); |
| 80 | |
| 81 | // let system_tray = SystemTray::new().with_menu(tray_menu); |
| 82 | |
| 83 | tauri::Builder::default() |
| 84 | .plugin(tauri_plugin_opener::init()) |
| 85 | .plugin(tauri_plugin_notification::init()) |
| 86 | .setup(|app| { |
| 87 | use tauri_plugin_notification::NotificationExt; |
| 88 | app.notification() |
| 89 | .builder() |
| 90 | .title("Stack") |
| 91 | .body("Stack is started.") |
| 92 | .show() |
| 93 | .unwrap(); |
| 94 | |
| 95 | Ok(()) |
| 96 | }) |
| 97 | // .plugin(tauri_plugin_positioner::init()) |
| 98 | .plugin(tauri_plugin_cli::init()) |
| 99 | .setup(|app| { |
| 100 | let handle = app.handle(); |
| 101 | // *APP.lock().unwrap() = Some(handle.clone()); |
| 102 | |
| 103 | tray::create_tray(handle)?; |
| 104 | |
| 105 | #[cfg(desktop)] |
| 106 | let _ = app |
| 107 | .handle() |
| 108 | .plugin(tauri_plugin_updater::Builder::new().build()); |
| 109 | |
| 110 | #[cfg(desktop)] |
| 111 | { |
| 112 | use tauri_plugin_autostart::MacosLauncher; |
| 113 | use tauri_plugin_autostart::ManagerExt; |
| 114 | |
| 115 | let _ = handle.plugin(tauri_plugin_autostart::init( |
| 116 | MacosLauncher::LaunchAgent, |
| 117 | Some(vec!["--autostart"]), |
| 118 | )); |
| 119 | |
| 120 | // Get the autostart manager |
| 121 | let autostart_manager = app.autolaunch(); |
| 122 | // Enable autostart |
| 123 | let _ = autostart_manager.enable(); |
| 124 | // Check enable state |
| 125 | println!( |
| 126 | "registered for autostart? {}", |
| 127 | autostart_manager.is_enabled().unwrap() |
| 128 | ); |
| 129 | // Disable autostart |
| 130 | let _ = autostart_manager.disable(); |
| 131 | } |
no test coverage detected