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.

1 Answer 1


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' https://launchpad.net/distros/ubuntu/+ticket/506 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: http://www.xfree86.org/current/xset.1.html

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

  • Please see if you can help out here: ubuntuforums.org/…
    – user25656
    Mar 26, 2013 at 4:51
  • 1
    This works in Xfce xfconf-query -c accessibility -p "/StickyKeys" -nt bool -s 'true'
    – xged
    Apr 19, 2017 at 16:37

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.