User xkb changes not permanent

by Braaedy   Last Updated September 11, 2019 18:02 PM

So, base problem is I'm trying to invert my laptop's pgup/home and pgdn/end keys. Currently I have to use the function key to to access the home/end functionalities and I'd prefer it the other way.

So I found this answer: https://unix.stackexchange.com/a/188251/370442 Created a file like so (inside my $HOME):

.xkb
└── keycodes
    └── local

with contents:

xkb_keycodes {
  <PGUP> = 110;
  <HOME> = 112;
  <PGDN> = 115;
  <END> = 117;
};

and execute command:

setxkbmap -print | sed -e '/xkb_keycodes/s/"[[:space:]]/+local&/' | xkbcomp -I${HOME}/.xkb - $DISPLAY

Which works. The keys are mapped exactly as I'd hope. However, every time I restart my computer (haven't tried specifically logging out and back in to see if it's different) the keys have returned to their original mappings. I was under the impression that this was a permanent command.

I then found this answer suggesting that gnome might be resetting my xkb settings: https://askubuntu.com/a/582498/550300 but changing the key suggested there had no noticeable effect on restart.

That's my backstory, here's my question: how do I make the above command permanent? I was trying to avoid adding something to my .bashrc because I thought there should've been a more permanent solution without directly overwriting the xkb files or executing a script on startup.



Related Questions


Updated October 27, 2017 23:02 PM

Updated July 20, 2015 17:01 PM

Updated October 29, 2018 18:02 PM

Updated December 20, 2015 17:01 PM