#x11 #detect #linux

x11_keypress_detect

Tiny crate to provide access to X11 display and a function to return true if a key is pressed, or false if not

1 unstable release

0.2.2 Dec 29, 2023
0.2.1 Dec 29, 2023
0.1.1 Dec 29, 2023
0.1.0 Dec 29, 2023

#852 in Unix APIs

GPL-3.0-or-later

3KB

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

Dependencies

~445KB