added system tray

This commit is contained in:
Ren Amamiya
2023-02-25 21:02:56 +07:00
parent 16680f456e
commit 4a5ad7b677
5 changed files with 46 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ extern crate objc;
use std::time::Duration;
use tauri::{Manager, WindowEvent};
use tauri::{Manager, WindowEvent, SystemTray};
use webpage::{Webpage, WebpageOptions};
use window_ext::WindowExt;
@@ -49,6 +49,8 @@ async fn opengraph(url: String) -> OpenGraphResponse {
}
fn main() {
let tray = SystemTray::new();
tauri::Builder::default()
.setup(|app| {
let main_window = app.get_window("main").unwrap();
@@ -57,6 +59,7 @@ fn main() {
Ok(())
})
.system_tray(tray)
.invoke_handler(tauri::generate_handler![opengraph])
.plugin(tauri_plugin_sql::Builder::default().build())
.on_window_event(|e| {