When one presses and holds down certain keys like Control, Alt, Super, no release event is generated while with other keys' multiple release & press events are generated simulating the key being pushed & released several times.

I want to make some of the multimedia keys or the Fnkey on my keyboard into modifier keys, and xev shows that all of them are of the second type. Is it possible to make ordinary keys sticky so that no release event is generated?


If I understand you right, what you want is to uncheck the option "Key presses repeat when key is held down" at Menu > System > Preferences > Keyboard.

enter image description here

  • Thanks for the reply. This does prevent a single press from generating multiple key events. However this still doesn't allow the Fn key or the other keys to be used as modifiers like the Ctrl/Alt/Shift/Super. Specifically, I want "xmodmap add" to work with keys other than Ctrl/Alt/Shift/Super. May 2 '11 at 0:57
  • 1
    You are looking for something like this: linuxquestions.org/questions/linux-hardware-18/… ?
    – desgua
    May 2 '11 at 11:44

The first thing you need to do is identify the 'keycode' or 'keysym' of the key you would like to replace and the key you would like to replace it with.

Let's do an example of replacing the 'F12' key with 'Left Super'.

  1. Open the terminal and run this command:

xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'

This will run xev which captures keypresses, strips out irrelevant information and gives you, via the terminal output, both the 'keycode' and 'keysym' of the key which you press. Press each of the keys you want to replace and the one you want to replace it with.

When I press F12 on my keyboard, I get this output:

96 F12

And when I press Left Super on my keyboard, I get this output:

133 Super_L

You will need to write these down somewhere or remember them to use later.

  1. Open up a text editor and enter this text (my example of replacing F12 with Left Super):

keycode 96 = Super_L


keysym F12 = Super_L

In my testing, either option should work.

  1. Save this file in your home directory as .Xmodmap (note the capitalised "X")

  2. To test it out, in terminal again enter this command from your home directory:

xmodmap .Xmodmap

If everything went to plan, your F12 key should now work as your Left Super.

Each time you make a change to your .Xmodmap file you can run the above command again to apply changes.

You shouldn't need to run this command each time you login, as it should be read and applied each time you login. If however this doesn't work, then of course you could place this command into a startup script.

There are a few caveats to mention:

a) Some keyboards will have a key labelled "Fn" or similar to access secondary functions on keys, like multimedia controls. From what I've read, you cannot remap this particular "Fn" key itself, though you should be able to remap the individual multimedia keys that pressing "Fn+key" provides.

b) If you unplug and re-plug back in your keyboard, you will need to reload the .Xmodmap configuration with the same command give in step 4 above.

c) If for some reason you want to comment out (ignore) a line in the .Xmodmap file, you need to put a "!" at the front of the line (instead of a "#" as in some other configuration files).

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.