basic readme

This commit is contained in:
Robin Appelman 2023-06-17 15:58:20 +02:00
commit bac40818cb

26
README.md Normal file
View file

@ -0,0 +1,26 @@
# evdev-shortcut
Global shortcuts using evdev
## Usage
```rust
#[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.