Global shortcuts using evdev
  • Rust 98.8%
  • Nix 1.2%
Find a file
2023-06-17 18:05:25 +02:00
.github/workflows update to streams 2023-06-17 15:52:26 +02:00
examples update to streams 2023-06-17 15:52:26 +02:00
src tracing/state str 2023-06-17 17:59:06 +02:00
.envrc update to streams 2023-06-17 15:52:26 +02:00
.gitignore update to streams 2023-06-17 15:52:26 +02:00
Cargo.lock tracing/state str 2023-06-17 17:59:06 +02:00
Cargo.toml 0.1.1 2023-06-17 18:05:25 +02:00
flake.lock update to streams 2023-06-17 15:52:26 +02:00
flake.nix update to streams 2023-06-17 15:52:26 +02:00
README.md basic readme 2023-06-17 15:58:20 +02:00

evdev-shortcut

Global shortcuts using evdev

Usage

#[tokio::main]
async fn main() {
let listener = ShortcutListener::new();
listener.add(Shortcut::new(&[Modifier::Meta], Key::KeyN));

    let devices =
        glob::glob("/dev/input/by-id/*-kbd").unwrap().collect::<Result<Vec<PathBuf>, GlobError>>().unwrap();

    let stream = listener.listen(&devices).unwrap();

    pin_mut!(stream);

    while let Some(shortcut) = stream.next().await {
        dbg!(shortcut);
    }
}

Note that raw access to evdev devices is a privileged operation and usually requires root.