Crates.io | x11_keypress_detect |
lib.rs | x11_keypress_detect |
version | 0.2.2 |
source | src |
created_at | 2023-12-29 18:33:42.823764 |
updated_at | 2023-12-29 21:49:19.21631 |
description | Tiny crate to provide access to X11 display and a function to return true if a key is pressed, or false if not |
homepage | https://github.com/muesli4brekkies/x11_keypress_detect |
repository | https://github.com/muesli4brekkies/x11_keypress_detect |
max_upload_size | |
id | 1083545 |
size | 2,883 |
A very simple crate providing access to the x11 display and a boolean to check if a key is pressed
This crate contains two public functions -
get_display()
- Gets an instance of the X11 display. This needs to be run first to instantiate the X11 display connection.
- Only do this once per program, multiple calls will eventually stack up and crash.
key_pressed()
- Returns a boolean, true if a key is pressed during detection or false otherwise.
use x11_keypress_detect::*;
fn main() {
let display = get_display();
loop {
println!("{}",key_pressed(&display))
}
}