back to normal setup methods

This commit is contained in:
PandaDEV 2024-08-25 17:40:52 +10:00
parent 69686f7514
commit 75583ac6ce
No known key found for this signature in database
GPG key ID: 13EFF9BAF70EE75C
6 changed files with 56 additions and 106 deletions

View file

@ -1,18 +1,9 @@
use tauri::plugin::TauriPlugin;
use tauri::Manager;
use rdev::{listen, EventType, Key};
use crate::utils::commands;
use tauri::Manager;
pub fn init() -> TauriPlugin<tauri::Wry> {
tauri::plugin::Builder::new("hotkeys")
.setup(|app, _| {
setup(app.app_handle().clone());
Ok(())
})
.build()
}
use crate::utils::commands::center_window_on_current_monitor;
fn setup(app_handle: tauri::AppHandle) {
pub fn setup(app_handle: tauri::AppHandle) {
std::thread::spawn(move || {
let mut meta_pressed = false;
listen(move |event| {
@ -29,7 +20,7 @@ fn setup(app_handle: tauri::AppHandle) {
let window = app_handle.get_webview_window("main").unwrap();
window.show().unwrap();
window.set_focus().unwrap();
commands::center_window_on_current_monitor(&window);
center_window_on_current_monitor(&window);
}
}
_ => {}