Spam enter to complete Shakes
All checks were successful
Rust / build (push) Successful in 1m23s

This commit is contained in:
tommy 2024-10-21 21:03:04 -04:00
parent 11d0001624
commit a860a906b7
Signed by: tommy
GPG Key ID: 56B522AB2EF2263A

View File

@ -2,6 +2,7 @@ use std::sync::{Arc, Mutex};
use rdev::{simulate, Event, EventType, SimulateError};
use std::process::exit;
const ENTER_KEY: rdev::Key = rdev::Key::Return;
const SPACE_KEY: rdev::Key = rdev::Key::Space;
const ESCAPE_KEY: rdev::Key = rdev::Key::Escape;
const SUSPEND_KEY: rdev::Key = rdev::Key::SemiColon;
@ -22,6 +23,10 @@ fn main() {
let callback = move |event: Event| {
let mut matched: bool = false;
match event.event_type {
EventType::KeyPress(key) if key == ENTER_KEY => {
send(EventType::KeyPress(rdev::Key::KeyS));
send(EventType::KeyRelease(rdev::Key::KeyS));
},
EventType::KeyPress(key) if key == SPACE_KEY => {
let suspended = suspended.lock().unwrap();
if *suspended {