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.
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'.
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.
keycode 96 = Super_L
or
keysym F12 = Super_L
In my testing, either option should work.
Save this file in your home directory as
.Xmodmap
(note the capitalised "X")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).