xmodmap hanging the system for 20 secs and not sticking 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

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


I had the same problem on xubuntu 14.04 (64) and xmodmap (with exactly the same keys) and found a solution using xkb instead of xmodmap:
Remapping Keys in Ubuntu (using xkb)
The xkb solution requires only to change the keycodes in 
/usr/share/X11/symbols/pc

and clear xkb cache by
rm -rf /var/lib/xkb/*

I had no delays afterwards. Maybe this works with Linux Mint as well.

When xmodmap runs, it calls XChangeKeyboardMapping once for each key it modifies, which generates MappingNotify events. In some configurations (mine included), this burst of events causes the system to hang for some time.
I had this problem while creating a customized keyboard map, and my (ugly) workaround was writing a program that generates the C source code that will apply all modifications by calling XChangeKeyboardMapping only once, thereby triggering MappingNotify only once.
Before running this code, you must apply your map, since it will get the current keyboard mapping.
#include <stdlib.h>
#include <stdio.h>
#include <X11/XKBlib.h>

int main(void) {
    Display* display;
    int min, max, i, j, k;
    int keysyms_per_keycode;
    KeySym* keysyms;

    display = XOpenDisplay(NULL);
    XDisplayKeycodes(display, &min, &max);
    keysyms = XGetKeyboardMapping(display, min, max-min, &keysyms_per_keycode);
    printf("#include <stdlib.h>\n");
    printf("#include <stdio.h>\n");
    printf("#include <X11/XKBlib.h>\n\n");
    printf("int main(void) {\n");
    printf("    int first_keycode = %d;\n", min);
    printf("    int keysyms_per_keycode = %d;\n", keysyms_per_keycode);
    printf("    int num_of_keycodes = %d;\n", max-min);
    printf("    KeySym keysyms[%d] = {", ((max-min) * keysyms_per_keycode) + 1);
    for (k = 0, i = 0; i < (max-min); i++) {
for (j = 0; j < keysyms_per_keycode; j++) {
printf("%ld,", keysyms[k++]);
}
    }
    printf("0};\n");
    printf("    Display* display = XOpenDisplay(NULL);\n");
    printf("    XChangeKeyboardMapping(display,first_keycode,keysyms_per_keycode,keysyms,num_of_keycodes);\n");
    printf("    XCloseDisplay(display);\n");
    printf("    return 0;\n");
    printf("}\n");

    XFree(keysyms);
    XCloseDisplay(display);

    return 0;
}

Compile with gcc -lX11.