0

I am trying to figure out how to use my .xinitrc file to load an xmodmap configuration file. Although this seems to be a popular problem around the internet, I can't seem to get it working. I am running Arch Linux and am using Gnome as my desktop environment. Initially, all that was in my .xinitrc file was exec gnome-session. I have tried putting the xmodmap command (which works if I manually run it in a terminal) before and after the gnome-session command:

xmodmap ~/.xmodmap
exec gnome-session

and

exec gnome-session
xmodmap ~/.xmodmap

but neither worked. As suggested elsewhere on the internet, I also tried doing this with a sleep before the xmodmap command:

sleep 20 && xmodmap ~/.xmodmap
exec gnome-session

and

exec gnome-session
sleep 20 && xmodmap ~/.xmodmap

but neither worked.

  • Please paste the output of pacman -Q xorg-xmodmap systemctl list-unit-files --state=enabled. – jasonwryan Jun 9 '18 at 4:39
  • @jasonwryan First command output: xorg-xmodmap 1.0.9-2, second command enabled unit files: autovt@.service, getty@.service, netctl@myWifNetwork.service, remote-fs.target – wxyz Jun 9 '18 at 4:52
  • Please read the xinitrc wiki article and ensure that you source the correct scripts at the start of the file. Then use your first example above. – jasonwryan Jun 9 '18 at 4:56
  • @jasonwryan Thanks, I hadn't followed that page. But even after making those changes, my first example didn't work. I believe exec gnome-session or something else is resetting my keyboard layout. I've posted an answer to my own question which uses the sleep command (a bit inelegant, but the best I can do at this point). – wxyz Jun 10 '18 at 6:36
0

The way I got this working was to put an & after the sleep/xmodmap command (i.e. running it in the background), and put the full command before gnome-session (and the sleep command was necessary):

sleep 20 && xmodmap ~/.xmodmap &
exec gnome-session

I believe exec gnome-session or something else is resetting my keyboard layout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.