x11_keypress_detect

Crates.iox11_keypress_detect
lib.rsx11_keypress_detect
version0.2.2
sourcesrc
created_at2023-12-29 18:33:42.823764
updated_at2023-12-29 21:49:19.21631
descriptionTiny crate to provide access to X11 display and a function to return true if a key is pressed, or false if not
homepagehttps://github.com/muesli4brekkies/x11_keypress_detect
repositoryhttps://github.com/muesli4brekkies/x11_keypress_detect
max_upload_size
id1083545
size2,883
(muesli4brekkies)

documentation

README

x11_keypress_detect

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.

Example

use x11_keypress_detect::*;
fn main() {
   let display = get_display();
   loop {
       println!("{}",key_pressed(&display))
   }
}
Commit count: 14

cargo fmt