User xkb changes not permanent

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

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: Created a file like so (inside my $HOME):

└── 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: 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

Underline in Persian keyboard

Updated October 27, 2017 23:02 PM