Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like turning sticky keys on and off to be done from a script. This is especially helpful to those not using kde/gnome/xfce.

share|improve this question
up vote 4 down vote accepted

This script works:

$ cat $HOME/bin/sticky_keys 
xkbset exp -bell -sticky -twokey -latchlock -accessx -feedback -stickybeep -led 9999
xkbset bell sticky -twokey -latchlock feedback led stickybeep

(If you would prefer pressing Shift twice to mean "hold down shift" then change '-latchlock' above to 'latchlock')

For more and related information, you probably will like this wiki page:

Because of the missing tool 'xorgcfg' or 'xf86cfg' in the ubuntu repository, you have to use the commandline tool 'xkbset'. Which isn't very user-friendly. You have to call 'xkbset' twice. By the first call, you set the expiry of the accessx settings. This is necessary, because there is a default timeout. By the second call, you can adjust the accessx settings themself. I don't know why, but in my settings, this was the required order!

With xkbset -h you will get a help message.

An example for setting the expiry of the accessx settings: xkbset exp -bell -sticky -twokey -latchlock -accessx -feedback -stickybeep -led

You have to disable the expiry of all accessx settings you need. Because, if you set an explicit timeout with '0', you will cause a xorg runtime error.

An example for adjust the accessx settings: xkbset bell sticky -twokey latchlock feedback led stickybeep

For further information refer to:

In the Configuration example below you see a setup for daily usage.

share|improve this answer
Please see if you can help out here:… – user25656 Mar 26 '13 at 4:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.