I want to shuffle a few keys around with XKB. (Why? On a laptop where some keys are inconveniently located.) I currently use xmodmap:keycode 110 = Priorkeycode 115 = Deletekeycode 112 = Nextkeycode 117 = Insertkeycode 119 = Endkeycode 118 = HomeInstead I want to use XKB and assign different symbolic names for certain physical keys, rather than assign different keysyms to certain keycodes. (This is why.) I want keycode 110 to send PGUP instead of HOME, keycode 115 to send DELE instead of END, etc. The rest of the configuration must not be affected (so PGUP is to keep sending the keysym Prior, etc., and all other keys remain as they are).How can I change the assignment of these specific keycodes? I'll load a file with xkbcomp somefile.xkb $DISPLAY, what do I need to put in somefile.xkb?
Override a few keycodes with XKB
x11;keyboard layout;xkb
Create a file containing your keycode changes, and save it as (for example) ~/.xkb/keycodes/local. (The keycodes directory is hard-coded; the base directory can be something else, and the filename too.) This will contain in your casexkb_keycodes {  <PGUP> = 110;  <PGDN> = 112;  <DELE> = 115;  <INS> = 117;  <HOME> = 118;  <END> = 119;};To load this, runsetxkbmap -print | sed -e '/xkb_keycodes/s/[[:space:]]/+local&/' | xkbcomp -I${HOME}/.xkb - $DISPLAYThis outputs your current settings, adds +local to the xkb_keycodes include statement, and loads it into the XKB compiler, adding ~/.xkb to the include path. (If you named your file something other than ~/.xkb/keycodes/local, you'll obviously need to change +local and -I${HOME}/.xkb}.) That way all the other settings are preserved.