Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinrubek/global-keybind
Use evdev to send a specific input event to X windows when using Wayland
https://github.com/justinrubek/global-keybind
evdev flake input keybind nix nix-flake rust wayland x11
Last synced: about 1 month ago
JSON representation
Use evdev to send a specific input event to X windows when using Wayland
- Host: GitHub
- URL: https://github.com/justinrubek/global-keybind
- Owner: justinrubek
- Created: 2024-03-17T03:10:13.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-17T21:23:02.000Z (9 months ago)
- Last Synced: 2024-10-12T05:25:54.332Z (2 months ago)
- Topics: evdev, flake, input, keybind, nix, nix-flake, rust, wayland, x11
- Language: Nix
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# global keybind
This can be useful when running a wayland compositor, as it allows you to send applications input without focusing them (or an xwayland window).
For example, you can use this to pass a push-to-talk keybind to a voice chat application.## usage
### cli
Determine the event device for the input device you want to use.
This can be done by running `evtest` and looking for the device with the name of the input device you want to use.
Alternatively, you can use `cat /proc/bus/input/devices` and look for the device with the name of the input device you want to use.You will also need to determine the event code for the key you want to use.
This can be done by running `evtest`, selecting the device, then pressing the key you want to use.
The resulting code's value can be found from [the linux input-event-codes.h](https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h).Here is an example invocation of the program that will press F12 when the mouse side button is pressed: `global-keybind-cli --device /dev/input/event0 --key-to-press 275 --key-to-send F12`
### home-manager
A home-manager module is provided under the flake output `homeModules.global-keybind`.
This can be used to start a systemd user service that will run the program.
Here is an example configuration that will press F12 when the mouse side button is pressed:```nix
global-keybind = {
enable = true;
device = "/dev/input/event5";
display = ":1";
key_to_press = 275;
key_to_send = "F12";
};
```