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.
apt-get install -y software-properties-common python-software-properties
# C++
apt-get install -y g++
# Java 8
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
apt-get install -y oracle-java8-installer
# Bazel dependencies
apt-get install -y pkg-config zip zlib1g-dev unzip git
# Build bazel
git clone https://github.com/google/bazel.git ~/bazel && cd ~/bazel
~/bazel/compile.sh
sudo cp ~/bazel/bazel-bin/src/bazel /usr/local/bin
pacman -S jdk8-openjdk zip unzip zlib pkg-config
mkdir -p ~/git_repos/github/google
cd ~/git_repos/github/google
git clone https://github.com/google/bazel.git
cd bazel
./compile.sh
sudo cp /home/kozikow/git_repos/github/google/bazel/output/bazel /usr/local/bin/
git clone https://github.com/kozikow/keyremaplinux ~/keyremaplinux
cd ~/keyremaplinux
bazel build //keyremaplinux:keyremaplinux
sudo nice -n -20 ./bazel-bin/keyremaplinux/keyremaplinux kozikow_standard
sudo cp keyremaplinux.service /etc/systemd/system/multi-user.target.wants/keyremaplinux.service
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