Go to file
moparisthebest d0e38d0e55
All checks were successful
moparisthebest/rusty-keys/pipeline/head This commit looks good
Avoid index out of bounds on strange keys (Apple)
2021-09-25 01:36:50 -04:00
.ci Test compilation with each feature individually 2021-09-25 00:51:00 -04:00
src Avoid index out of bounds on strange keys (Apple) 2021-09-25 01:36:50 -04:00
systemd Add sample systemd service 2017-11-16 00:31:56 -05:00
.gitignore rusty-keys is now well supported on windows 2019-10-07 01:59:43 -04:00
appveyor.yml Add travis-ci and appveyor builds 2020-07-11 00:49:03 -04:00
Cargo.lock Updated all package versions 2021-09-24 00:10:02 -04:00
Cargo.toml make toml and serde optional, if not included, can hardcode config 2021-09-25 00:45:29 -04:00
keymap.toml Support multiple revert_default_keys 2021-04-03 17:15:38 -04:00
LICENSE.md Final tweaks before release 2017-09-22 00:30:56 -04:00
notes.txt Send SYN_REPORT with shift modifying keys to make libinput happy 2017-12-06 00:06:44 -05:00
README.md update readme 2021-09-23 23:29:56 -04:00
win.sh rusty-keys is now well supported on windows 2019-10-07 01:59:43 -04:00

rusty-keys

Build Status

low level keyboard mapper for linux and windows, with advanced caps lock and shift swapping behavior

This is the only keymapper I am aware of capable of implementing this layout, which I call Unix Programmer's Dvorak, which has been my daily driver since 2014:
Unix Programmer's Dvorak

The Problem

If you ever have mapped keys on linux, you know that there is the console keymap (loadkeys) and the X keymap (setxkbmap), also things like SDL and Virtualbox grab the input directly and respect no maps. Lastly I want to revert to QWERTY when holding ctrl so ctrl+c works just like normal, without remapping all programs to ctrl+j. Linux keymaps cannot do this either.

The Solution

  1. Grab a keyboard device directly so only we can read events from it.
  2. Create a new keyboard input device with uinput, this looks identical to any other keyboard device to anything running on the box.
  3. Read input_events from the real device, map them, send them to our created device.

This solution is what rusty-keys implements, it works in ttys, in X, in Wayland, in virtualbox even running windows or whatever, on SDL games, it will work literally everywhere, because rusty-keys just creates a regular keyboard.

How to run

When ran, it will read a keymap.toml configuration file, refer to example and tweak to suit.

Usage: rusty-keys [options] [device_files...]

Options:
    -h, --help          prints this help message
    -v, --version       prints the version
    -c, --config FILE   specify the keymap config file to use (default:
                        /etc/rusty-keys/keymap.toml)

when ran without specifying input devices, it maps all currently connected keyboards, and watches /dev/input/ with inotify and starts mapping any new keyboards that are plugged in forever, until you kill it: rusty-keys

or you can specify one or multiple input devices, and it will run until all are disconnected, then stop:
rusty-keys /dev/input/event0 or rusty-keys /dev/input/event0 /dev/input/event2

An example systemd service is in systemd/rusty-keys.service, enable it to have mapped keyboards all the time.

How to install

License

AGPLv3 for now, message me if you have a problem with this

Notes

Technically this is a re-implementation of a previous python program I had been using for 3 years previously.