You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
3.3 KiB

2 months ago
2 months ago
4 years ago
4 years ago
2 months ago
4 years ago
6 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
2 months ago
  1. rusty-keys
  2. ==========
  3. [![Build Status](https://ci.moparisthe.best/job/moparisthebest/job/rusty-keys/job/master/badge/icon%3Fstyle=plastic)](https://ci.moparisthe.best/job/moparisthebest/job/rusty-keys/job/master/)
  4. low level keyboard mapper for linux and windows, with advanced caps lock and shift swapping behavior
  5. 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:
  6. ![Unix Programmer's Dvorak](https://www.moparisthebest.com/kbs/programmer-dvorak-NoSecondary-NumpadStandard-NoSwap-StandardNums-SwapAt-SwapPipe.svg)
  7. The Problem
  8. -----------
  9. If you ever have mapped keys on linux, you know that there is the console keymap (loadkeys) and the X keymap (setxkbmap),
  10. also things like SDL and Virtualbox grab the input directly and respect no maps. Lastly I want to revert to QWERTY when
  11. holding ctrl so ctrl+c works just like normal, without remapping all programs to ctrl+j. Linux keymaps cannot do this either.
  12. The Solution
  13. ------------
  14. 1. Grab a keyboard device directly so only we can read events from it.
  15. 2. Create a new keyboard input device with uinput, this looks identical to any other keyboard device to anything running on the box.
  16. 3. Read input_events from the real device, map them, send them to our created device.
  17. This solution is what rusty-keys implements, it works in ttys, in X, in Wayland, in virtualbox even running windows or whatever,
  18. on SDL games, it will work literally everywhere, because rusty-keys just creates a regular keyboard.
  19. How to run
  20. ----------
  21. When ran, it will read a keymap.toml configuration file, refer to example and tweak to suit.
  22. ```
  23. Usage: rusty-keys [options] [device_files...]
  24. Options:
  25. -h, --help prints this help message
  26. -v, --version prints the version
  27. -c, --config FILE specify the keymap config file to use (default:
  28. /etc/rusty-keys/keymap.toml)
  29. ```
  30. when ran without specifying input devices, it maps all currently connected keyboards, and watches /dev/input/ with
  31. inotify and starts mapping any new keyboards that are plugged in forever, until you kill it:
  32. `rusty-keys`
  33. or you can specify one or multiple input devices, and it will run until all are disconnected, then stop:
  34. `rusty-keys /dev/input/event0` or `rusty-keys /dev/input/event0 /dev/input/event2`
  35. An example systemd service is in systemd/rusty-keys.service, enable it to have mapped keyboards all the time.
  36. How to install
  37. --------------
  38. * `cargo install rusty-keys`
  39. * Arch Linux [rusty-keys](https://aur.archlinux.org/packages/rusty-keys/) [rusty-keys-git](https://aur.archlinux.org/packages/rusty-keys-git/)
  40. * Download a static binary for your system from the [releases](https://code.moparisthebest.com/moparisthebest/rusty-keys/releases) section. [github mirror](https://github.com/moparisthebest/rusty-keys/releases)
  41. License
  42. -------
  43. AGPLv3 for now, message me if you have a problem with this
  44. Notes
  45. -----
  46. Technically this is a re-implementation of a [previous](https://code.moparisthebest.com/moparisthebest/uinput-mapper/src/master/uinputmapper/keymapper.py) [python](https://code.moparisthebest.com/moparisthebest/uinput-mapper/src/master/keymaps/dvorak.py) [program](https://code.moparisthebest.com/moparisthebest/uinput-mapper/src/master/input-read#L151)
  47. I had been using for 3 years previously.