Files
yaak-mountain-loop/src-tauri/src/main.rs
2023-02-19 23:11:59 -08:00

43 lines
1.0 KiB
Rust

#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
#[cfg(target_os = "macos")]
#[macro_use]
extern crate objc;
mod commands;
mod runtime;
mod window_ext;
use tauri::{Manager, WindowEvent};
use window_ext::WindowExt;
fn main() {
tauri::Builder::default()
.setup(|app| {
let win = app.get_window("main").unwrap();
win.position_traffic_lights();
Ok(())
})
.on_window_event(|e| {
let apply_offset = || {
let win = e.window();
win.position_traffic_lights();
};
match e.event() {
WindowEvent::Resized(..) => apply_offset(),
WindowEvent::ThemeChanged(..) => apply_offset(),
_ => {}
}
})
.invoke_handler(tauri::generate_handler![
commands::send_request,
commands::greet
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}