Skip to content

Commit

Permalink
Improve key name resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro committed Nov 28, 2023
1 parent 9777e2c commit a0c4d3c
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 300 deletions.
19 changes: 10 additions & 9 deletions examples/tests/a_to_b.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::thread;
use std::time::Duration;
use map2::key_primitives::Key;

use crate::*;

Expand All @@ -8,18 +9,18 @@ async fn hello_world() -> PyResult<()> {
Python::with_gil(|py| -> PyResult<()> {
let m = pytests::include_python!();

reader_send(py, m, "reader", &EvdevInputEvent::new(&Default::default(), &KEY_A.event_code, 1));
reader_send(py, m, "reader", &EvdevInputEvent::new(&Default::default(), &KEY_A.event_code, 0));
reader_send(py, m, "reader", &Key::from_str("a").unwrap().to_input_ev(1));
reader_send(py, m, "reader", &Key::from_str("a").unwrap().to_input_ev(0));

py.allow_threads(|| { thread::sleep(Duration::from_millis(25)); });

assert_eq!((
writer_read(py, m, "writer"),
writer_read(py, m, "writer"),
), (
Some(EvdevInputEvent::new(&Default::default(), &KEY_B.event_code, 1)),
Some(EvdevInputEvent::new(&Default::default(), &KEY_B.event_code, 0)),
));
assert_eq!(
writer_read_all(py, m, "writer"),
vec![
Key::from_str("b").unwrap().to_input_ev(1),
Key::from_str("b").unwrap().to_input_ev(0),
]
);

Ok(())
})?;
Expand Down
5 changes: 3 additions & 2 deletions examples/tests/wasd_mouse_control.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::thread;
use std::time::Duration;
use evdev_rs::enums::{EV_REL, EventCode};
use map2::key_primitives::Key;

use crate::*;

Expand All @@ -9,12 +10,12 @@ async fn wasd_mouse_control() -> PyResult<()> {
Python::with_gil(|py| -> PyResult<()> {
let m = pytests::include_python!();

reader_send(py, m, "reader_kbd", &EvdevInputEvent::new(&Default::default(), &KEY_W.event_code, 1));
reader_send(py, m, "reader_kbd", &Key::from_str("w").unwrap().to_input_ev(1));

// sleep for long enough to trigger the timeout once
py.allow_threads(|| { thread::sleep(Duration::from_millis(25)); });

reader_send(py, m, "reader_kbd", &EvdevInputEvent::new(&Default::default(), &KEY_W.event_code, 0));
reader_send(py, m, "reader_kbd", &Key::from_str("w").unwrap().to_input_ev(0));

assert_eq!(
writer_read_all(py, m, "writer_mouse"),
Expand Down
32 changes: 16 additions & 16 deletions src/event_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use crate::mapper::*;
pub(crate) fn update_modifiers(state: &mut State, action: &KeyAction) -> bool {
// TODO find a way to do this with a single accessor function
let pairs: [(Key, fn(&KeyModifierState) -> bool, fn(&mut KeyModifierState) -> &mut bool); 8] = [
(*KEY_LEFT_CTRL, |s| s.left_ctrl, |s: &mut KeyModifierState| &mut s.left_ctrl),
(*KEY_RIGHT_CTRL, |s| s.right_ctrl, |s: &mut KeyModifierState| &mut s.right_ctrl),
(*KEY_LEFT_ALT, |s| s.left_alt, |s: &mut KeyModifierState| &mut s.left_alt),
(*KEY_RIGHT_ALT, |s| s.right_alt, |s: &mut KeyModifierState| &mut s.right_alt),
(*KEY_LEFT_SHIFT, |s| s.left_shift, |s: &mut KeyModifierState| &mut s.left_shift),
(*KEY_RIGHT_SHIFT, |s| s.right_shift, |s: &mut KeyModifierState| &mut s.right_shift),
(*KEY_LEFT_META, |s| s.left_meta, |s: &mut KeyModifierState| &mut s.left_meta),
(*KEY_RIGHT_META, |s| s.right_meta, |s: &mut KeyModifierState| &mut s.right_meta),
(*KEY_LEFTCTRL, |s| s.left_ctrl, |s: &mut KeyModifierState| &mut s.left_ctrl),
(*KEY_RIGHTCTRL, |s| s.right_ctrl, |s: &mut KeyModifierState| &mut s.right_ctrl),
(*KEY_LEFTALT, |s| s.left_alt, |s: &mut KeyModifierState| &mut s.left_alt),
(*KEY_RIGHTALT, |s| s.right_alt, |s: &mut KeyModifierState| &mut s.right_alt),
(*KEY_LEFTSHIFT, |s| s.left_shift, |s: &mut KeyModifierState| &mut s.left_shift),
(*KEY_RIGHTSHIFT, |s| s.right_shift, |s: &mut KeyModifierState| &mut s.right_shift),
(*KEY_LEFTMETA, |s| s.left_meta, |s: &mut KeyModifierState| &mut s.left_meta),
(*KEY_RIGHTMETA, |s| s.right_meta, |s: &mut KeyModifierState| &mut s.right_meta),
];

for (key, is_modifier_down, modifier_mut) in pairs.iter() {
Expand Down Expand Up @@ -59,20 +59,20 @@ fn release_restore_modifiers(state: &mut State, output_device: &mut VirtualOutpu
};

if from_flags.ctrl && !to_flags.ctrl {
release_or_restore_modifier(&actual_state.left_ctrl, &*KEY_LEFT_CTRL);
release_or_restore_modifier(&actual_state.right_ctrl, &*KEY_RIGHT_CTRL);
release_or_restore_modifier(&actual_state.left_ctrl, &*KEY_LEFTCTRL);
release_or_restore_modifier(&actual_state.right_ctrl, &*KEY_RIGHTCTRL);
}
if from_flags.shift && !to_flags.shift {
release_or_restore_modifier(&actual_state.left_shift, &*KEY_LEFT_SHIFT);
release_or_restore_modifier(&actual_state.right_shift, &*KEY_RIGHT_SHIFT);
release_or_restore_modifier(&actual_state.left_shift, &*KEY_LEFTSHIFT);
release_or_restore_modifier(&actual_state.right_shift, &*KEY_RIGHTSHIFT);
}
if from_flags.alt && !to_flags.alt {
release_or_restore_modifier(&actual_state.left_alt, &*KEY_LEFT_ALT);
release_or_restore_modifier(&actual_state.right_alt, &*KEY_RIGHT_ALT);
release_or_restore_modifier(&actual_state.left_alt, &*KEY_LEFTALT);
release_or_restore_modifier(&actual_state.right_alt, &*KEY_RIGHTALT);
}
if from_flags.meta && !to_flags.meta {
release_or_restore_modifier(&actual_state.left_meta, &*KEY_LEFT_META);
release_or_restore_modifier(&actual_state.right_meta, &*KEY_RIGHT_META);
release_or_restore_modifier(&actual_state.left_meta, &*KEY_LEFTMETA);
release_or_restore_modifier(&actual_state.right_meta, &*KEY_RIGHTMETA);
}

// TODO eat keys we just released, un-eat keys we just restored
Expand Down
148 changes: 26 additions & 122 deletions src/key_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,9 @@ lazy_static! {
pub static ref BTN_LEFT: Key = Key::from_str("BTN_LEFT").unwrap();
pub static ref BTN_MIDDLE: Key = Key::from_str("BTN_MIDDLE").unwrap();
pub static ref BTN_RIGHT: Key = Key::from_str("BTN_RIGHT").unwrap();
pub static ref KEY_6: Key = Key::from_str("KEY_6").unwrap();
pub static ref KEY_A: Key = Key::from_str("KEY_A").unwrap();
pub static ref KEY_B: Key = Key::from_str("KEY_B").unwrap();
pub static ref KEY_BACKSPACE: Key = Key::from_str("KEY_BACKSPACE").unwrap();
pub static ref KEY_C: Key = Key::from_str("KEY_C").unwrap();
pub static ref KEY_CAPSLOCK: Key = Key::from_str("KEY_CAPSLOCK").unwrap();
pub static ref KEY_D: Key = Key::from_str("KEY_D").unwrap();
pub static ref KEY_DOWN: Key = Key::from_str("KEY_DOWN").unwrap();
pub static ref KEY_E: Key = Key::from_str("KEY_E").unwrap();
pub static ref KEY_ENTER: Key = Key::from_str("KEY_ENTER").unwrap();
pub static ref KEY_ESC: Key = Key::from_str("KEY_ESC").unwrap();
pub static ref KEY_F: Key = Key::from_str("KEY_F").unwrap();
pub static ref KEY_G: Key = Key::from_str("KEY_G").unwrap();
pub static ref KEY_GRAVE: Key = Key::from_str("KEY_GRAVE").unwrap();
pub static ref KEY_H: Key = Key::from_str("KEY_H").unwrap();
pub static ref KEY_I: Key = Key::from_str("KEY_I").unwrap();
pub static ref KEY_J: Key = Key::from_str("KEY_J").unwrap();
pub static ref KEY_K: Key = Key::from_str("KEY_K").unwrap();
pub static ref KEY_KPD0: Key = Key::from_str("KEY_KP0").unwrap();
pub static ref KEY_KPD1: Key = Key::from_str("KEY_KP1").unwrap();
pub static ref KEY_KPD2: Key = Key::from_str("KEY_KP2").unwrap();
Expand All @@ -39,133 +24,52 @@ pub static ref KEY_KPD6: Key = Key::from_str("KEY_KP6").unwrap();
pub static ref KEY_KPD7: Key = Key::from_str("KEY_KP7").unwrap();
pub static ref KEY_KPD8: Key = Key::from_str("KEY_KP8").unwrap();
pub static ref KEY_KPD9: Key = Key::from_str("KEY_KP9").unwrap();
pub static ref KEY_F1: Key = Key::from_str("KEY_F1").unwrap();
pub static ref KEY_F2: Key = Key::from_str("KEY_F2").unwrap();
pub static ref KEY_F3: Key = Key::from_str("KEY_F3").unwrap();
pub static ref KEY_F4: Key = Key::from_str("KEY_F4").unwrap();
pub static ref KEY_F5: Key = Key::from_str("KEY_F5").unwrap();
pub static ref KEY_F6: Key = Key::from_str("KEY_F6").unwrap();
pub static ref KEY_F7: Key = Key::from_str("KEY_F7").unwrap();
pub static ref KEY_F8: Key = Key::from_str("KEY_F8").unwrap();
pub static ref KEY_F9: Key = Key::from_str("KEY_F9").unwrap();
pub static ref KEY_F10: Key = Key::from_str("KEY_F10").unwrap();
pub static ref KEY_F11: Key = Key::from_str("KEY_F11").unwrap();
pub static ref KEY_F12: Key = Key::from_str("KEY_F12").unwrap();
pub static ref KEY_F13: Key = Key::from_str("KEY_F13").unwrap();
pub static ref KEY_F14: Key = Key::from_str("KEY_F14").unwrap();
pub static ref KEY_F15: Key = Key::from_str("KEY_F15").unwrap();
pub static ref KEY_F16: Key = Key::from_str("KEY_F16").unwrap();
pub static ref KEY_F17: Key = Key::from_str("KEY_F17").unwrap();
pub static ref KEY_F18: Key = Key::from_str("KEY_F18").unwrap();
pub static ref KEY_F19: Key = Key::from_str("KEY_F19").unwrap();
pub static ref KEY_F20: Key = Key::from_str("KEY_F20").unwrap();
pub static ref KEY_F21: Key = Key::from_str("KEY_F21").unwrap();
pub static ref KEY_F22: Key = Key::from_str("KEY_F22").unwrap();
pub static ref KEY_F23: Key = Key::from_str("KEY_F23").unwrap();
pub static ref KEY_F24: Key = Key::from_str("KEY_F24").unwrap();
pub static ref KEY_L: Key = Key::from_str("KEY_L").unwrap();
pub static ref KEY_LEFT: Key = Key::from_str("KEY_LEFT").unwrap();
pub static ref KEY_LEFTBRACE: Key = Key::from_str("KEY_LEFTBRACE").unwrap();
pub static ref KEY_LEFTSHIFT: Key = Key::from_str("KEY_LEFTSHIFT").unwrap();
pub static ref KEY_LEFT_ALT: Key = Key::from_str("KEY_LEFTALT").unwrap();
pub static ref KEY_LEFT_CTRL: Key = Key::from_str("KEY_LEFTCTRL").unwrap();
pub static ref KEY_LEFT_META: Key = Key::from_str("KEY_LEFTMETA").unwrap();
pub static ref KEY_LEFT_SHIFT: Key = Key::from_str("KEY_LEFTSHIFT").unwrap();
pub static ref KEY_M: Key = Key::from_str("KEY_M").unwrap();
pub static ref KEY_MINUS: Key = Key::from_str("KEY_MINUS").unwrap();
pub static ref KEY_N: Key = Key::from_str("KEY_N").unwrap();
pub static ref KEY_O: Key = Key::from_str("KEY_O").unwrap();
pub static ref KEY_P: Key = Key::from_str("KEY_P").unwrap();
pub static ref KEY_LEFTALT: Key = Key::from_str("KEY_LEFTALT").unwrap();
pub static ref KEY_LEFTCTRL: Key = Key::from_str("KEY_LEFTCTRL").unwrap();
pub static ref KEY_LEFTMETA: Key = Key::from_str("KEY_LEFTMETA").unwrap();
pub static ref KEY_PAGEDOWN: Key = Key::from_str("KEY_PAGEDOWN").unwrap();
pub static ref KEY_PAGEUP: Key = Key::from_str("KEY_PAGEUP").unwrap();
pub static ref KEY_Q: Key = Key::from_str("KEY_Q").unwrap();
pub static ref KEY_R: Key = Key::from_str("KEY_R").unwrap();
pub static ref KEY_RIGHT: Key = Key::from_str("KEY_RIGHT").unwrap();
pub static ref KEY_RIGHTBRACE: Key = Key::from_str("KEY_RIGHTBRACE").unwrap();
pub static ref KEY_RIGHTALT: Key = Key::from_str("KEY_RIGHTALT").unwrap();
pub static ref KEY_RIGHTCTRL: Key = Key::from_str("KEY_RIGHTCTRL").unwrap();
pub static ref KEY_RIGHTMETA: Key = Key::from_str("KEY_RIGHTMETA").unwrap();
pub static ref KEY_RIGHTSHIFT: Key = Key::from_str("KEY_RIGHTSHIFT").unwrap();
pub static ref KEY_RIGHT_ALT: Key = Key::from_str("KEY_RIGHTALT").unwrap();
pub static ref KEY_RIGHT_CTRL: Key = Key::from_str("KEY_RIGHTCTRL").unwrap();
pub static ref KEY_RIGHT_META: Key = Key::from_str("KEY_RIGHTMETA").unwrap();
pub static ref KEY_RIGHT_SHIFT: Key = Key::from_str("KEY_RIGHTSHIFT").unwrap();
pub static ref KEY_S: Key = Key::from_str("KEY_S").unwrap();
pub static ref KEY_SEMICOLON: Key = Key::from_str("KEY_SEMICOLON").unwrap();
pub static ref KEY_SLASH: Key = Key::from_str("KEY_SLASH").unwrap();
pub static ref KEY_SPACE: Key = Key::from_str("KEY_SPACE").unwrap();
pub static ref KEY_T: Key = Key::from_str("KEY_T").unwrap();
pub static ref KEY_TAB: Key = Key::from_str("KEY_TAB").unwrap();
pub static ref KEY_U: Key = Key::from_str("KEY_U").unwrap();
pub static ref KEY_UP: Key = Key::from_str("KEY_UP").unwrap();
pub static ref KEY_V: Key = Key::from_str("KEY_V").unwrap();
pub static ref KEY_W: Key = Key::from_str("KEY_W").unwrap();
pub static ref KEY_X: Key = Key::from_str("KEY_X").unwrap();
pub static ref KEY_Y: Key = Key::from_str("KEY_Y").unwrap();
pub static ref KEY_Z: Key = Key::from_str("KEY_Z").unwrap();
}


lazy_static! {
pub(crate) static ref KEY_ALIAS_TABLE: HashMap<&'static str, (Key, KeyModifierFlags)> = {
let mut m = HashMap::new();
m.insert("ALT", (*KEY_LEFT_ALT, KeyModifierFlags::new()));
m.insert("BACKSPACE", (*KEY_BACKSPACE, KeyModifierFlags::new()));
m.insert("BTN_LEFT", (*BTN_LEFT, KeyModifierFlags::new()));
m.insert("BTN_MIDDLE", (*BTN_MIDDLE, KeyModifierFlags::new()));
m.insert("BTN_RIGHT", (*BTN_RIGHT, KeyModifierFlags::new()));
m.insert("CAPSLOCK", (*KEY_CAPSLOCK, KeyModifierFlags::new()));
m.insert("CTRL", (*KEY_LEFT_CTRL, KeyModifierFlags::new()));
m.insert("DOWN", (*KEY_DOWN, KeyModifierFlags::new()));
m.insert("ESC", (*KEY_ESC, KeyModifierFlags::new()));
m.insert("F1", (*KEY_F1, KeyModifierFlags::new()));
m.insert("F10", (*KEY_F10, KeyModifierFlags::new()));
m.insert("F11", (*KEY_F11, KeyModifierFlags::new()));
m.insert("F12", (*KEY_F12, KeyModifierFlags::new()));
m.insert("F13", (*KEY_F13, KeyModifierFlags::new()));
m.insert("F14", (*KEY_F14, KeyModifierFlags::new()));
m.insert("F15", (*KEY_F15, KeyModifierFlags::new()));
m.insert("F16", (*KEY_F16, KeyModifierFlags::new()));
m.insert("F17", (*KEY_F17, KeyModifierFlags::new()));
m.insert("F18", (*KEY_F18, KeyModifierFlags::new()));
m.insert("F19", (*KEY_F19, KeyModifierFlags::new()));
m.insert("F2", (*KEY_F2, KeyModifierFlags::new()));
m.insert("F20", (*KEY_F20, KeyModifierFlags::new()));
m.insert("F21", (*KEY_F21, KeyModifierFlags::new()));
m.insert("F22", (*KEY_F22, KeyModifierFlags::new()));
m.insert("F23", (*KEY_F23, KeyModifierFlags::new()));
m.insert("F24", (*KEY_F24, KeyModifierFlags::new()));
m.insert("F3", (*KEY_F3, KeyModifierFlags::new()));
m.insert("F4", (*KEY_F4, KeyModifierFlags::new()));
m.insert("F5", (*KEY_F5, KeyModifierFlags::new()));
m.insert("F6", (*KEY_F6, KeyModifierFlags::new()));
m.insert("F7", (*KEY_F7, KeyModifierFlags::new()));
m.insert("F8", (*KEY_F8, KeyModifierFlags::new()));
m.insert("F9", (*KEY_F9, KeyModifierFlags::new()));
m.insert("KPD0", (*KEY_KPD0, KeyModifierFlags::new()));
m.insert("KPD1", (*KEY_KPD1, KeyModifierFlags::new()));
m.insert("KPD2", (*KEY_KPD2, KeyModifierFlags::new()));
m.insert("KPD3", (*KEY_KPD3, KeyModifierFlags::new()));
m.insert("KPD4", (*KEY_KPD4, KeyModifierFlags::new()));
m.insert("KPD5", (*KEY_KPD5, KeyModifierFlags::new()));
m.insert("KPD6", (*KEY_KPD6, KeyModifierFlags::new()));
m.insert("KPD7", (*KEY_KPD7, KeyModifierFlags::new()));
m.insert("KPD8", (*KEY_KPD8, KeyModifierFlags::new()));
m.insert("KPD9", (*KEY_KPD9, KeyModifierFlags::new()));
m.insert("LEFT", (*KEY_LEFT, KeyModifierFlags::new()));
m.insert("LEFT_ALT", (*KEY_LEFT_ALT, KeyModifierFlags::new()));
m.insert("LEFT_CTRL", (*KEY_RIGHT_CTRL, KeyModifierFlags::new()));
m.insert("LEFT_META", (*KEY_LEFT_META, KeyModifierFlags::new()));
m.insert("ALT", (*KEY_LEFTALT, KeyModifierFlags::new()));
m.insert("CTRL", (*KEY_LEFTCTRL, KeyModifierFlags::new()));
m.insert("ESCAPE", (*KEY_ESC, KeyModifierFlags::new()));
m.insert("KEYPAD_0", (*KEY_KPD0, KeyModifierFlags::new()));
m.insert("KEYPAD_1", (*KEY_KPD1, KeyModifierFlags::new()));
m.insert("KEYPAD_2", (*KEY_KPD2, KeyModifierFlags::new()));
m.insert("KEYPAD_3", (*KEY_KPD3, KeyModifierFlags::new()));
m.insert("KEYPAD_4", (*KEY_KPD4, KeyModifierFlags::new()));
m.insert("KEYPAD_5", (*KEY_KPD5, KeyModifierFlags::new()));
m.insert("KEYPAD_6", (*KEY_KPD6, KeyModifierFlags::new()));
m.insert("KEYPAD_7", (*KEY_KPD7, KeyModifierFlags::new()));
m.insert("KEYPAD_8", (*KEY_KPD8, KeyModifierFlags::new()));
m.insert("KEYPAD_9", (*KEY_KPD9, KeyModifierFlags::new()));
m.insert("LEFT_ALT", (*KEY_LEFTALT, KeyModifierFlags::new()));
m.insert("LEFT_CTRL", (*KEY_RIGHTCTRL, KeyModifierFlags::new()));
m.insert("LEFT_SHIFT", (*KEY_LEFTSHIFT, KeyModifierFlags::new()));
m.insert("META", (*KEY_LEFT_META, KeyModifierFlags::new()));
m.insert("META", (*KEY_LEFTMETA, KeyModifierFlags::new()));
m.insert("PAGE_DOWN", (*KEY_PAGEDOWN, KeyModifierFlags::new()));
m.insert("PAGE_UP", (*KEY_PAGEUP, KeyModifierFlags::new()));
m.insert("RIGHT", (*KEY_RIGHT, KeyModifierFlags::new()));
m.insert("RIGHT_ALT", (*KEY_RIGHT_ALT, KeyModifierFlags::new()));
m.insert("RIGHT_CTRL", (*KEY_RIGHT_CTRL, KeyModifierFlags::new()));
m.insert("RIGHT_META", (*KEY_RIGHT_META, KeyModifierFlags::new()));
m.insert("RIGHT_ALT", (*KEY_RIGHTALT, KeyModifierFlags::new()));
m.insert("RIGHT_BRACE", (*KEY_RIGHTBRACE, KeyModifierFlags::new()));
m.insert("LEFT_BRACE", (*KEY_LEFTBRACE, KeyModifierFlags::new()));
m.insert("RIGHT_CTRL", (*KEY_RIGHTCTRL, KeyModifierFlags::new()));
m.insert("RIGHT_SHIFT", (*KEY_RIGHTSHIFT, KeyModifierFlags::new()));
m.insert("SHIFT", (*KEY_LEFTSHIFT, KeyModifierFlags::new()));
m.insert("SPACE", (*KEY_SPACE, KeyModifierFlags::new()));
m.insert("TAB", (*KEY_TAB, KeyModifierFlags::new()));
m.insert("UP", (*KEY_UP, KeyModifierFlags::new()));
m
};
}
Expand Down
17 changes: 14 additions & 3 deletions src/key_primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@ pub struct Key {
}

impl Key {
pub fn from_str(s: &str) -> Result<Self> {
match EventCode::from_str(&EventType::EV_KEY, s) {
pub fn from_str(key_name: &str) -> Result<Self> {
let mut key_name = key_name.to_uppercase();

// prefix if not already
if !key_name.starts_with("KEY_") && !key_name.starts_with("BTN_") {
key_name = "KEY_".to_string().tap_mut(|s| s.push_str(&key_name));
}

match EventCode::from_str(&EventType::EV_KEY, &key_name) {
Some(event_code) => { Ok(Key { event_code }) }
None => { Err(anyhow!("key not found: '{}'", s)) }
None => { Err(anyhow!("key not found: '{}'", key_name)) }
}
}

pub fn to_input_ev(&self, state: i32) -> EvdevInputEvent {
EvdevInputEvent::new(&Default::default(), &self.event_code, state)
}
}


Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ extern crate regex;

use std::{fs, io};
use std::borrow::BorrowMut;
// #[macro_use]
// use subscriber::linkable;
use std::hash::{DefaultHasher, Hash, Hasher};
use std::io::Write;
use std::ops::{Deref, DerefMut};
use std::sync::{Arc, mpsc, Mutex, RwLock, Weak};
use std::thread;
use std::time::Duration;

pub use anyhow::{anyhow, Result};
use arc_swap::{ArcSwap, ArcSwapOption};
use arc_swap::ArcSwapOption;
use evdev_rs::enums::EventCode;
pub use evdev_rs::InputEvent as EvdevInputEvent;
use nom::lib::std::collections::HashMap;
use tap::Tap;
use uuid::Uuid;

use event_loop::EVENT_LOOP;
Expand All @@ -39,10 +43,6 @@ pub use crate::key_defs::*;
use crate::key_primitives::*;
use crate::state::*;

// #[macro_use]
// use subscriber::linkable;
use std::hash::{Hash, Hasher, DefaultHasher};

pub mod key_defs;
pub mod state;
pub mod key_primitives;
Expand Down
Loading

0 comments on commit a0c4d3c

Please sign in to comment.