2

Universal Access options, namely Mouse Keys and Mouse Keys Acceleration, are not persisted between shutdowns on Ubuntu 22.04. How to make them persist?

Related questions:

xkbset setting does not persist - does not appear to work on Ubuntu 22.04

Repeat keys settings don't work after reboot in Gnome - one comment related to a bug with an earlier (Gnome or Ubuntu) version, and one wrong answer

Accessibility features not loaded at startup - no answers

1 Answers1

2

To inspect what expiry options are currently set (credit to user aioobe on xkbset setting does not persist):

xkbset q exp

Configure the desired options not to expire on their own:

xkbset =mousekeys
xkbset =mousekeysaccel

See xkbset --help for syntax and examples.

Configure mouse key acceleration:

xkbset mousekeysaccel 60 10 10 20 10

The above options alone would not persist on Ubuntu 22.04 as opposed to 20.04; mouse keys have to be enabled manually after startup (by pressing Num Lock twice, or toggling Settings > Accessibility > Pointing & Clicking > Mouse keys off and on again), which would cause the mouse key acceleration not to apply either. To work around this issue, add the following command to Startup Applications:

xkbset mousekeys

With the above options, the whole mouse keys feature may still expire on its own after an unknown timeout. Manually add the expiration command into the startup applications as a workaround for this issue:

xkbset exp =mousekeys

The commands may need to be set in a specific execution order, i.e.:

  1. xkbset mousekeys
  2. xkbset exp =mousekeys
  3. xkbset mousekeysaccel 60 10 10 20 10
  4. xkbset exp =mousekeysaccel

Startup Applications are executed in alphabetical order, so you may need to add a specific Name for the commands to make sure the mouse keys are active before the mouse key acceleration is set.

  • Sometimes the mouse keys feature just refuses to activate itself on startup, no matter what is defined in the Startup Applications and in what order. The best workaround for that scenario is still just to go to Edit that startup application command, copy the command, and manually paste it into a new Terminal session. – banaanihillo Oct 27 '22 at 10:24