Define your keyboard layout as C++ class. Primarily focused on implementing my keyboard layout.
- Just single representation for a key to deal with - input_event code from input_event_codes.h. No need to distinguish between scancode, keysym or keycode.
- For complex layouts, xmodmap/xcape gets hard to maintain: https://github.com/kozikow/kozikow-layout-linux.
- Thread per keyboard lets you have different layout per keyboard.
- Unit test your layout.
git clone https://github.com/kozikow/keyremaplinux ~/keyremaplinux
cd ~/keyremaplinux
bazel build //keyremaplinux
sudo nice -n -20 ./bazel-bin/keyremaplinux/keyremaplinux kozikow_standard
sudo cp keyremaplinux.service /etc/systemd/system
sudo systemctl enable keyremaplinux.service
sudo systemctl restart keyremaplinux.service
- Extend Remapper and implement function Remap.
- For example KozikowLayoutRemapper.
- In function Remap, consume and produce Linux input event from input.h. What you consume is what user have typed. What you produce is what OS will see.
- Event codes are defined in input-event-codes.h
bazel test //keyremaplinux:all --test_output=errors