How to apply Xmodmap permanently

Solution 1:

You can use gnome-session-properties (in the Dash can be found by typing Startup - it will find the Startup Applications Preferences application:

see:

screenshot

Then add a new command for xmodmap. Use the absolute path to the file you want to launch with xmodmap:

see:

screenshot

You can also switch back to a “normal” layout using: setxkbmap -layout fr (replace “fr” with “us” or your keyboard layout variant).

Solution 2:

Any changes to the key bindings using xmodmap or xkb will be trampled if you suspend or change keymap. Also, on login, they won't work in the first few seconds (since GNOME will load its own keymap later).

See here for details and a few workarounds; personally I'm using dedalu's script.