I am using Ubuntu 14.04.

I have a custom Xmodmap keyboard layout. However, when I resume after suspend, the layout is gone.

I have tried all things which were mentioned in the answers to this question: How do I set Xmodmap on login?

Neither using .xinitrc nor adding a command in the startup apps works. Well, they do work after a usual reboot, but not after suspend.

Is there a file that is always execute after loggin in, no matter if it was a reboot or a resume from suspension?


@i08in https://askubuntu.com/a/92235/72576 seems to do the job.

This is what I ended up with on my Debian jessie, KDE.


case "${1}" in
        su $USER -c "sleep 3; /usr/bin/xmodmap /home/$USER/.Xmodmap" &

Note: At first it may seem to not work, but just give it a minute or so. There seems to be something with X that cuses this delay, though I haven't cared enough to check on it... See https://superuser.com/q/626769/185360 for more info.

  • Don't forget to mark your script as executable. Additionally, on my machine I can do away with the "sleep 3", so you may want to fiddle with the duration in an attempt to reduce the delay without affecting the operation of the script. – fouric Aug 6 '15 at 17:27

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.