-
Notifications
You must be signed in to change notification settings - Fork 0
Keyboard Remapping
The following article was written for Monka 3072 Pro V2 keyboard in mind. The keyboard has a main MCU HFD80CP100 which appears to be based on/clone of SONIX SN32F299 and uses 05ac:024f Apple, Inc. Aluminium Keyboard (ANSI) driver on linux. The best way to resolve the issues I faced was using hid-apple-patched-dkms driver. Keyd remapper can help solve it as well but deactivates bootloader (requires more investigation).
A patched version of hid-apple allows GNU/Linux user to swap the FN and left Control keys and some other mapping tweaks on Macbook Pro, external Apple keyboards and probably other Apple devices. Available at AUR as dkms pkg
yay -S hid-apple-patched-dkms-git
Then, create file /etc/modprobe.d/hid_apple.conf The following configuration emulates a standard PC layout:
options hid_apple fnmode=1
options hid_apple swap_fn_leftctrl=0
options hid_apple swap_opt_cmd=1
options hid_apple rightalt_as_rightctrl=1
options hid_apple ejectcd_as_delete=1
Finally, apply the new config file:
sudo update-initramfs -u
or for dracut
sudo dracut --force
To (re-)load the module for immediate use, run
sudo modprobe -r hid_apple; sudo modprobe hid_apple
Permanent configuration is done in file /etc/modprobe.d/hid_apple.conf. The format is one option-value pair per line, like swap_fn_leftctrl=1. After writing to the file, do sudo update-initramfs -u and reboot.
Temporary configuration (applies immediately but is lost after rebooting) is possible by writing to virtual files in /sys/module/hid_apple/parameters/, like echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_fn_leftctrl.
These options are from the original mainstream hid-apple module:
-
fnmode- Mode of top-row keys-
0= disabled -
1= normally media keys, switchable to function keys by holding Fn key (Default) -
2= normally function keys, switchable to media keys by holding Fn key
-
-
swap_opt_cmd- Swap the Option ("Alt") and Command ("Flag") keys-
0= as silkscreened, Mac layout (Default) -
1= swapped, PC layout
-
-
swap_fn_leftctrl- Swap the Fn and left Control keys-
0= as silkscreened, Mac layout (Default) -
1= swapped, PC layout
-
-
iso_layout- Enable/Disable hardcoded ISO-layout of the keyboard. Possibly relevant for international keyboard layouts-
0= disabled, -
1= enabled (Default)
-
And these options were added in the patched version:
-
rightalt_as_rightctrl- Use the right Alt key as a right Ctrl key-
0= as silkscreened, Mac layout (Default) -
1= swapped, PC layout
-
-
ejectcd_as_delete- Use Eject-CD key as Delete key, if available-
0= disabled (Default) -
1= enabled
-
-
lock_as_delete- Use Lock key as Delete key, if available-
0= disabled (Default) -
1= enabled
-
-
swap_fn_f13_insert- Swap the Fn and f13 keys, making Fn Insert and f13 Fn. For people who need Insert-
0= disabled (Default), -
1= enabled
-
Note: swap_fn_f13_insert will be ignored if swap_fn_leftctrl is activated.
A flexible system wide key remapping daemon for linux which remaps keys using kernel level input primitives (evdev, uinput)
- Speed: a hand tuned input loop written in C that takes <1ms
- Simplicity: a config format that is intuitive
- Consistency: modifiers that play nicely with layers by default
- Modularity (a UNIXy core extensible through the use of an IPC mechanism
keyd has several unique features many of which are traditionally only found in custom keyboard firmware like QMK as well as some which are unique to keyd. Some of the more interesting ones include -
- Layers (with support for hybrid modifiers).
- Key overloading (different behaviour on tap/hold)
- Keyboard specific configuration.
- Instantaneous remapping (no more flashing
- A client-server model that facilitates scripting and display server agnostic application remapping. Currently ships with support for both X and Wayland.
- System wide config (works in a VT).
- First class support for modifier overloading.
- Unicode support.
- Would like to experiment with custom layers (i.e custom shift keys) and oneshot modifiers.
- Want to have multiple keyboards with different layouts on the same machine.
- Want to be able to remap
C-1without breaking modifier semantics. - Want a keyboard config format which is easy to grok.
- Like tiny daemons that adhere to the Unix philosophy.
- Want to put the control and escape keys where God intended.
- Wish to be able to switch to a VT to debug something without breaking their keymap.
- A tool for programming individual key up/down events.
sudo pacman -S keyd
sudo systemctl enable keyd --now
sudo systemctl disable keyd`
sudo keyd monitor
Create /etc/keyd/default.conf
[ids]
k:05ac:024f
[global]
overload_tap_timeout = 500
oneshot_timeout = 10000
chord_hold_timeout = 50
[main]
brightnessdown = f1
brightnessup = f2
scale = f3
dashboard = f4
kbdillumdown = f5
kbdillumup = f6
previoussong = f7
playpause = f8
nextsong = f9
mute = f10
volumedown = f11
volumeup = f12
References