#logic #trigger #device-query

keybind

Trigger logic on specific keybind

1 unstable release

0.1.0 Mar 30, 2019

#35 in #trigger


Used in clipperd

MIT license

5KB

Keybind

Wrapper around device_query providing a nicer API, allowing you to trigger your logic on specific keybind.

Full Documentation can be read here.

use keybind::{Keybind, Keycode};

fn main() {
    let mut keybind = Keybind::new(&[Keycode::LControl, Keycode::G]);

    keybind.on_trigger(|| {
        println!("This will be printed when you press CTRL+G");
    });

    keybind.wait();
}

lib.rs:

Keybind

Wrapper around device_query providing a nicer API, allowing you to trigger your logic on specific keybind.

Example

use keybind::{Keybind, Keycode};

fn main() {
   let mut keybind = Keybind::new(&[Keycode::LControl, Keycode::G]);

   keybind.on_trigger(|| {
       println!("This will be printed when you press CTRL+G");
   });

   keybind.wait();
}

Dependencies

~145KB