Skip to content

Commit

Permalink
add send and sync to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
thewh1teagle committed Nov 19, 2023
1 parent c563a76 commit 8204005
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions desktop/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use window_shadows::set_shadow;

use tauri::Manager;
use enigo::*;
use std::sync::Mutex;
use std::sync::{Arc,Mutex};
use tauri::State;


struct Controller(Mutex<Enigo>);
struct Controller(Arc<Mutex<Enigo>>);

#[tauri::command]
fn press(controller: State<'_, Controller>, key: &str) {
Expand Down Expand Up @@ -51,7 +51,7 @@ fn main() {

Ok(())
})
.manage(Controller(Mutex::new(controller)))
.manage(Controller(Arc::new(Mutex::new(controller))))
.invoke_handler(tauri::generate_handler![press])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down

0 comments on commit 8204005

Please sign in to comment.