Ubuntu – Turn Mousekeys on/off from keyboard

11.10keyboardnumpad

I have mousekeys turned on in the Universal Access menu and lots of posts as well as this documentation page:

https://help.ubuntu.com/11.10/ubuntu-help/mouse-mousekeys.html

mention that NUMLOCK or SHIFT+NUMLOCK toggles this on or off. Neither of these work for me. The only way I can apparently turn this feature off is using the Universal Access menu, which is annoying if all I want to do is toggle it off to type a few numbers.

I use mousekeys on Windows and it works fine.

I am running on Ubuntu 11.10 and my keyboard is a MS Ergonomic 4000.

I wonder if some other config setting is getting in the way?

Best Answer

I had the same problem. I'm also (still) on Ubuntu 11.10.

In my everyday work I use mousekeys primarily because I like using the num-5 key for mouse key presses.

Then I discovered that in Unity you can do very nice window tiling (ctrl-alt-num4 sends a window to the left of the screen, ctrl-alt-num6 to the right, ctrl-alt-9 top-right, etc).

So to do my window tiling I want to momentarily disable mousekeys.

I found the answer here: http://ubuntuforums.org/showpost.php?p=11776864&postcount=4

I saved the script as ubuntu-toggle-mousekeys and when I need to I type:

bash ubuntu-toggle-mousekeys

... in my terminal.

Here's my very slightly amended script - I just added some comments really:

#!/bin/bash

# http://ubuntuforums.org/showthread.php?t=1942984

# I needed this when I connected a big monitor to my ubuntu laptop.
# Unity has nice window tiling shortcuts that need the number keypad to work.
# ctrl-alt-num4 sends a window left, ctrl-alt-num6 sends a window right, etc.

STATUS=$(gsettings get org.gnome.desktop.a11y.keyboard mousekeys-enable) #Are mousekeys on (true or false)

if [ "$STATUS" == "true" ]
then
  gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable false 

  notify-send -i  "/usr/share/icons/gnome/48x48/devices/keyboard.png" "                    Mousekeys OFF"
  echo "Mousekeys are OFF - use ctrl-alt-num4 to send window left, ctrl-alt-num6 to send window right"

else
  gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable true

  notify-send -i  "/usr/share/icons/gnome/48x48/devices/keyboard.png" "                    Mousekeys ON"
  echo "Mousekeys are ON"
fi