ReviewOS

also looking at this

stacks/vite-plugin-tauri

feat: call custom window on tray icon event

#13
Open iamzjohn wants to merge feat/custom_window into main
43 files +5245 -1
examples/tray-with-custom-tray-menu-window/src-tauri/src/main.rsadded+24-0
Changes to examples/tray-with-custom-tray-menu-window/src-tauri/src/main.rs
@@ -0,0 +1,24 @@
1#![cfg_attr(
2 all(not(debug_assertions), target_os = "windows"),
3 windows_subsystem = "windows"
4)]
5
6use tauri::Manager;
7use tauri_plugin_positioner::{WindowExt, Position};
8
9#[tauri::command]
10fn move_window(app: tauri::AppHandle, window_label: String) {
11 if let Some(win) = app.get_window(&window_label) {
12 let _ = win.move_window(Position::TrayBottomCenter);
13 } else {
14 eprintln!("Window with label '{}' not found", window_label);
15 }
16}
17
18fn main() {
19 tauri::Builder::default()
20 .plugin(tauri_plugin_positioner::init())
21 .invoke_handler(tauri::generate_handler![move_window])
22 .run(tauri::generate_context!())
23 .expect("error while running tauri application");
24}