mirror of
https://codeberg.org/icewind/evdev-shortcut.git
synced 2026-06-03 18:14:10 +02:00
basic readme
This commit is contained in:
parent
07d9edac20
commit
bac40818cb
1 changed files with 26 additions and 0 deletions
26
README.md
Normal file
26
README.md
Normal 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.
|
||||
Loading…
Add table
Add a link
Reference in a new issue