Linux – xmodmap hanging the system for 20 secs and not sticking

linux-mintx11xmodmap

I edited the keyboard map using xmodmap as per https://wiki.archlinux.org/index.php/Xmodmap, and I have two problems: executing xmodmap ~/.Xmodmap completely hangs the system for 15-25secs, which seems a bit odd considereing I'm just remapping the keyboard, and the changes don't stick on logoff, and not even on suspend.

It's a pain in the ass for my boot time to be increased by 20 secs or more, plus having to run it everytime I wake up from suspend. Is this normal (I don't really think so?) and is there anything I can do, perhaps an alternative way to remap the keyboard?

Linux Mint 15 x64 Cinnamon

Best Answer

I had this problem with the xmodmap command to freeze the system for ~20 seconds. It appeared that I had the whole keymap in my .Xmodmap file, which forced xmodmap to remap every row in the config file.

This is how I solved that:

Before initiating custom xmodmap config:

# Store default xmodmap 
$ xmodmap -pke > ~/.Xmodmap.default 

# Backup your custom xmodmap
$ mv ~/.Xmodmap ~/.Xmodmap.bak

# Make a diff between default and custom xmodmap, and store the diff as .Xmodmap
$ diff ~/.Xmodmap.bak ~/.Xmodmap.default | grep '<' | tr '<' ' ' > ~/.Xmodmap
Related Question