mirror of
https://codeberg.org/icewind/shortcutd.git
synced 2026-06-04 01:34:08 +02:00
client lib
This commit is contained in:
parent
3e78aacb10
commit
6b81b14b81
4 changed files with 130 additions and 0 deletions
23
examples/client.rs
Normal file
23
examples/client.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use shortcutd_client::{Shortcut, ShortcutClient};
|
||||
use std::error::Error;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut client = ShortcutClient::new()?;
|
||||
|
||||
let shortcut: Shortcut = "<Ctrl><Alt>-KeyP".parse()?;
|
||||
|
||||
client.register(shortcut, |s| {
|
||||
eprintln!("shortcut1 {}", s);
|
||||
})?;
|
||||
|
||||
let shortcut: Shortcut = "<Ctrl><Alt>-KeyO".parse()?;
|
||||
|
||||
client.register(shortcut, |s| {
|
||||
eprintln!("shortcut2 {}", s);
|
||||
})?;
|
||||
|
||||
loop {
|
||||
client.process(Duration::from_millis(1000))?;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue