#trigger #logic #device-query

keybind

在特定按键绑定上触发逻辑

1个不稳定版本

0.1.0 2019年3月30日

#39 in #trigger


clipperd使用

MIT许可证

5KB

Keybind

device_query的包装库,提供更友好的API,允许你在特定的按键绑定上触发逻辑。

完整文档请参阅此处

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

device_query的包装库,提供更友好的API,允许你在特定的按键绑定上触发逻辑。

示例

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();
}

依赖项

~145KB