A Rust-based Linux devices input events reader.
- Reads input events from specified Linux input device files (e.g.,
/dev/input/eventX
or dumps). - Supports customizable keyboard layouts, models, rules, and locales.
- Handles key states and compose sequences for multi-character input.
- Outputs UTF-8 characters to standard output for real-time interaction.
- Rust.
- xkbcommon: Development libraries for keyboard handling.
You can install the necessary xkbcommon library with the following command:
sudo apt-get install libxkbcommon-dev
-
Clone the repository:
git clone https://github.com/lhamouche/rustevents cd rustevents
-
Build the project:
cargo build --release
-
Run the compiled binary located in the
target/release/
directory.
./target/release/rustevents [OPTIONS] --file <FILE>
Argument | Short | Default | Description |
---|---|---|---|
file |
-f |
(required) | The path to the input device file (e.g., /dev/input/eventX ). |
rules |
-r |
evdev |
The rules for the keyboard layout (e.g., evdev , xorg ). |
model |
-m |
pc105 |
The keyboard model. |
layout |
-l |
us |
The keyboard layout (e.g., us , fr ). |
variant |
-v |
"" |
Optional layout variant. |
locale |
-c |
en_US.UTF-8 |
The locale for compose sequences. |
no-numlock |
-n |
false |
Do not assume that Num Lock is active by default. |
-
Read input events from a keyboard connected to
/dev/input/event0
:./target/release/rustevents --file /dev/input/event0
-
Specify a different layout ,variant and locale:
./target/release/rustevents --file event0 --layout fr --variant latin9 -c fr.UTF-8