mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-18 07:23:51 +01:00
43 lines
1.0 KiB
Rust
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");
|
|
}
|