Is there any way to let the Shift, Ctrl and Alt keys behave as toggles under X? I know how one could do it under CLI (for example, by doing this) but found no reference for doing so under X.
Please note that this is not a question on sticky keys, which can be enabled by an accessibility option.
This is implemented on the DE level AFAIK. KDE has the option to Lock Sticky Keys:
http://docs.kde.org/stable/en/kdebase-workspace/kcontrol/kcmaccess/index.html
Keys in X11 are remapped with xmodmap, but there is no Control_Lock in /usr/include/X11/keysymdef.h
If you have a few keys you could map Control to something like ISO_Next_Group_Lock and define your keys in this group with Control + Key.
I found some info here: https://bbs.archlinux.org/viewtopic.php?id=75771
This can be achieved using XKB compatibility component
Check the compatibility variant you are using
Modify
misc
file, the one which contains the needed modifiers interpretationsI have changed
Shift_L
,Alt_L
&Alt_R
action fromSetMods
toLockMods
, added newShift_R
,Control_L
&Control_R
interpretation withLockMods
and commented//setMods.clearLocks
(not sure if it's needed). Here is the complete file:Compile the change & update the initramfs images
Reboot
References: