Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 582 Bytes

README.md

File metadata and controls

23 lines (18 loc) · 582 Bytes

Keybinder

crates.io

Wraps Keybinder in a safe way

Example

use keybinder::KeyBinder;

fn main() {
    gtk::init().expect("Failed to init GTK");
    let data = String::from("some data");
    let mut keybinder = KeyBinder::<String>::new(true).expect("Keybinder is not supported");

    assert_eq!(keybinder.bind("<Shift>space", |key, data| {
        println!("key: {} , data: {}", key, data);
        gtk::main_quit();
    }, data), true);
    println!("Successfully bound keystring to handler");
    gtk::main();
}