mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-09-14 18:05:13 +00:00
style(backend): formatting
This commit is contained in:
parent
56813684e1
commit
6365d18cdb
14 changed files with 36 additions and 35 deletions
|
@ -48,21 +48,21 @@ impl InputManager for RdevInputManager {
|
|||
|
||||
thread::spawn(move || {
|
||||
let cb = move |event: rdev::Event| match event.event_type {
|
||||
rdev::EventType::KeyPress(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_press.lock().unwrap() = true;
|
||||
}
|
||||
let is_shifted = *shift_clone_press.lock().unwrap();
|
||||
if let Some(ch) = key_to_char(&key, is_shifted) {
|
||||
callback_clone(InputEvent::KeyPress(ch));
|
||||
}
|
||||
rdev::EventType::KeyPress(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_press.lock().unwrap() = true;
|
||||
}
|
||||
rdev::EventType::KeyRelease(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_release.lock().unwrap() = false;
|
||||
}
|
||||
let is_shifted = *shift_clone_press.lock().unwrap();
|
||||
if let Some(ch) = key_to_char(&key, is_shifted) {
|
||||
callback_clone(InputEvent::KeyPress(ch));
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
rdev::EventType::KeyRelease(key) => {
|
||||
if key == Key::ShiftLeft || key == Key::ShiftRight {
|
||||
*shift_clone_release.lock().unwrap() = false;
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
if let Err(error) = rdev::listen(cb) {
|
||||
eprintln!("rdev error: {:?}", error)
|
||||
|
@ -492,4 +492,4 @@ pub fn key_to_char(key: &Key, is_shifted: bool) -> Option<char> {
|
|||
_ => return None,
|
||||
};
|
||||
s.chars().nth(if is_shifted { 1 } else { 0 })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue