houmain / keymapper

A cross-platform context-aware key remapper.
GNU General Public License v3.0
257 stars 21 forks source link

Additional documentation #87

Closed Lillecarl closed 7 months ago

Lillecarl commented 7 months ago

Hi!

Thanks for this great project! 😄 I'm working on NixOS and home-manager modules that I'll try to upstream.

Some things I noticed missing from the docs that might be good for first time users like myself of keyboard remapping solutions:

Layout switching

For those unaware, you have to switch input layouts on the new device that keymapper creates rather than your good old tested at-translated-set-2-keyboard (or whatever).

udev rules

Since keymapper can start whenever, restart whenever it doesn't have stable device names. This can be resolved with udev rules. Might be useful for applications like tp-auto-kbbl which reads inputs to toggle backlight on ThinkPads.

# Link keymapper to named devices
ACTION=="add", KERNEL=="event*", ATTRS{name}=="Keymapper", RUN+="/usr/bin/ln -sf /dev/input/%k /dev/input/keymapper_kb"
ACTION=="add", KERNEL=="mouse*", ATTRS{name}=="Keymapper", RUN+="/usr/bin/ln -sf /dev/input/%k /dev/input/keymapper_mouse"
ACTION=="remove", KERNEL=="event*", ATTRS{name}=="Keymapper", RUN+="/usr//bin/unlink /dev/input/keymapper_kb"
ACTION=="remove", KERNEL=="mouse*", ATTRS{name}=="Keymapper", RUN+="/usr/bin/unlink /dev/input/keymapper_mouse"

I guess keymapper could implement this linking within itself too if it'd want, but udev does the trick.

Layers

There's not much regarding how one could implement layers. I'm using this configuration to achieve something resembling layers: https://github.com/Lillecarl/nixos/blob/master/lillecarl/terminal/keymapper.nix#L7

That's all I've got, thanks for all your effort 😄