mirror of
https://codeberg.org/icewind/evdev-shortcut.git
synced 2026-06-03 10:04:11 +02:00
Global shortcuts using evdev
- Rust 98.8%
- Nix 1.2%
| .github/workflows | ||
| examples | ||
| src | ||
| .envrc | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
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.