The first step is to go into system -> preferences -> keyboard shortcuts and disable the keyboard shortcuts for play, stop, previous track and next track. This was a necessary first step, before it was done the keycodes would not show up in xev.
Once that was done I was able to follow the instructions in
I found the keycodes were
- FN+Left (aka previous): 173
- FN+Right (aka next): 171
- FN+UP (aka stop): 174
- FN+Down (aka play): 172
xev can again be used to determine the "keysyms" for home, end, page up and page down.
- Home: Home
- End: End
- Page up: Prior
- Page down: Next
One can remap the keys for the current session with
xmodmap -e "keycode 173 = Home"
xmodmap -e "keycode 171 = End"
xmodmap -e "keycode 174 = Prior"
xmodmap -e "keycode 172 = Next"
There doesn't seem to be any good way to make this permanent, apparently .Xmodmap doesn't work on many modern systems and all the other options seem to involve either manually running scripts or editing files in /usr, I decided editing files in /usr was the least bad option.
Specifically I edited /usr/share/X11/xkb/symbols/inet, replacing the settings for keys I171 through I174 with
key <I171> { [ End ] };
key <I172> { [ Next ] };
key <I173> { [ Home ] };
key <I174> { [ Prior ] };
Thanks to the following sources for nuggets of information needed to solve this problem
https://help.ubuntu.com/community/MultimediaKeys
https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450
https://askubuntu.com/questions/296155/how-can-i-remap-keyboard-keys/296437#296437
Use setxkbmap to swap the Left Shift and Left Control
xmodmap
commands from my X startup file (.xsession
). For a system-wide effect/etc/X11/Xsession.d
is also an option. – Ferenc Wágner Jun 09 '19 at 07:30