I would like to enable "sticky modifier keys" under archlinux + awesome, and I haven't found the correct info.
-
What is "sticky keys"?– Daniel AnderssonApr 10, 2012 at 7:31
-
right, I meant "sticky modifier keys", it means that pressing a modifier key acts as a toggle and usually the toggle is released on the next key press, so keys don't have to be pressed simultaneously but can be pressed in sequence. This is an accesibility for disabled users feature on OS-X, Gnome and probably Windows, and I find it more confortable and less hand straining with the feature on.– MacarioApr 10, 2012 at 7:43
4 Answers
I've got it. There is a utility called xbkeys for setting accessibiltiy options for xorg.
From xkbset manual ($ xkbset man):
To switch sticky keys on or off, and optionally set or reset:
() two keys pressed at the same time stops sticky keys;
() a modifier pressed twice will be locked:
[-]{sticky|st} [[-]twokey|[-]latchlock]...
I ran this:
$ xkbset sticky -twokey -latchlock
That command can go in .xinitrc
# turn on stickykeys. don't let two keys pressed at the same time disable it.
# don't turn on "latch lock", ie pressing a modifier key twice "locks" it on.
xkbset accessx sticky -twokey -latchlock
# don't expire these settings. (run xkbset q exp for details.)
xkbset exp 1 =accessx =sticky =twokey =latchlock
-
1Here is a link to
xkbset
: math.missouri.edu/~stephen/software/#xkbset– user193100Apr 4, 2013 at 23:11 -
-
3This answer is very helpful! Now I just want to find a way to limit the sticky behavior to the Shift keys. Jun 1, 2014 at 22:34
-
2@JayeshBhoot Yes; xkb has "latch" variants of some keys. I get sticky shift by mapping my shift keys to
ISO_Level2_Latch
which acts like shift for modifier purposes. (Some programs that look for the shift keycode specifically don't work withISO_Level2
, especially games.) I have my config online; but you'll need to look up some documentation on the specific details of applying custom key mappings. github.com/hallettj/dot-xmonad/blob/master/home/.config/X11/xkb/… Nov 15, 2019 at 17:17 -
1
You can use Xmodmap to set a key lock for the Scroll, Kana, Num, Caps, and Shift keys. Also some ISO groupings keys can be remapped this way. For example, on my keyboard, to set Left Shift as a toggle, use this:
xmodmap -e "keycode 50 = Shift_Lock"
use "xev" to get the correct keycode.
Just add the command inside the quotes to a file named .Xmodmap and restart X to have the changes permanent.
Unfortunately, I don't think there is a keycode to Lock the Control, Alt, or Meta keys. If you post a more specific question and add a decent bounty, I may be able to work out a shell script and/or xorg change to make this possible.
-
Unfortunatelly I haven't got any more points to offer, I really am missing sticky modifiers as in cntrl, window, alt, meta...– MacarioApr 19, 2012 at 21:37
-
One way to enable sticky keys is to press the StickyKeys_Enable
key. If you don’t have it mapped to your keyboard you can simulate the keypress with e.g. Xdotool:
> xdotool key StickyKeys_Enable
As far as I know, Xorg doesn't support this. It's not inconceivable for a custom keyboard driver to implement this, but I have never come across such a thing.
-
Mmm... I would really like to have this without having to resort to Gnome or XFCE... bummer!– MacarioApr 16, 2012 at 5:22