12

I would like to enable "sticky modifier keys" under archlinux + awesome, and I haven't found the correct info.

  • What is "sticky keys"? – Daniel Andersson Apr 10 '12 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. – Macario Apr 10 '12 at 7:43
21

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

 

| improve this answer | |
  • Here is a link to xkbset: math.missouri.edu/~stephen/software/#xkbset – user193100 Apr 4 '13 at 23:11
  • This is available in debian in the package xkbset. – Jesse Hallett Jun 1 '14 at 8:40
  • 3
    This answer is very helpful! Now I just want to find a way to limit the sticky behavior to the Shift keys. – Jesse Hallett Jun 1 '14 at 22:34
  • 1
    @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 with ISO_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/… – Jesse Hallett Nov 15 '19 at 17:17
  • 1
    @JesseHallett thank you for the pointer! I will try this out asap. – Jayesh Bhoot Nov 16 '19 at 3:20
5
+50

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.

| improve this answer | |
  • Unfortunatelly I haven't got any more points to offer, I really am missing sticky modifiers as in cntrl, window, alt, meta... – Macario Apr 19 '12 at 21:37
  • XKB is a better way to do this. Check Arch wiki – phil pirozhkov Jun 1 '14 at 23:17
1

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
| improve this answer | |
-1

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.

| improve this answer | |
  • Mmm... I would really like to have this without having to resort to Gnome or XFCE... bummer! – Macario Apr 16 '12 at 5:22

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.