Recently i bought a zuoya gmk67 keyboard, it doesn't have a function keys row and has a know for volume control. Unfortunately, if you plug your gmk67 in a linux machine you will notice that using fn+1
will not produce f1
as expected, it will produce a screen brightness decrease, and if you change the physical switch in the back for the macOS mode, the function keys now work, but the modifier keys don't, quite stressful.
Fear not, you can either remap the keys, as in this gist, or alter your system configuration so the keyboard functions normally, as seen in the gist Using GMK67 keyboard in linux. Function keys not working with Fn!.
For this gist, we can simply remap some keys while the physical switch in the back is in windows mode. For that let's install keyd
, a remapping tool daemon.
For aarch linux use:
$ yay -S keyd
I know you are smart, you can figure how to install on other distros ;)
Then start teh daemon:
$ sudo systemctl enable --now keyd
Create the following file:
/etc/keyd/gmk67.conf
:
###
# GMK76 remap config file
###
[ids]
# all interface (BT, USB, 2.4Ghz dongle)
k:05ac:024f
[main]
# Maps capslock to escape when pressed and control when held.
# capslock = overload(control, esc)
# Remaps the escape key to capslock
#esc = capslock
brightnessdown = f1
brightnessup = f2
scale = f3
dashboard = f4
kbdillumdown = f5
kbdillumup = f6
previoussong = f7
playpause = f8
nextsong = f9
mute = f10
volumedown = f11
volumeup = f12
# activates nav while held, but a tap is a normal capslock
capslock = overload(nav, capslock)
[nav]
up = pageup
down = pagedown
left = home
right = end
[meta]
mute = playpause
volumedown = volumedown
volumeup = volumeup
Then run this command to load the config:
$ sudo keyd reload
And bam, it now works!
This config works by remapping the multimedia events firectly into function keys, furthermore, while doing this the knob will stop working as it will produce function keys instead of the volume control we want, so we bind a key, meta
, so teh know will emit volume control if we do meta+knob
.
In the top we also see a id
section, this matches the physical vendor id of your device, in this case mine appears as 'Apple, Inc. Aluminium Keyboard (ANSI)'. You can check yours using:
$ lsusb
or by using keyd monitor and seeing the vendor id while typing something.
$ sudo systemctl stop keyd
$ sudo keyd monitor
- If you dont want to do any of this, just change the id to
*
. This will match all keyboards in your machine
As a bonus i remapped capslock
to be used as a key modifier for the directional arrows and map them to pgup, pgdown, home
and end
respectively
vlw d+ poupou no mínimo 1 hora da minha vida rsrs