Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2013-07-20 21:00:50

#! Member
From: The Netherlands
Registered: 2011-04-27
Posts: 69

Enabling mousekeys

Mousekeys: to point and click with the numerical keys instead of a mouse. Apparently it's a feature of X, which once was enabled by default—but not anymore. Luckily we can pretty easily enable and configure it, with a utility called xkbset.

sudo apt-get install xkbset


xkbset m

to turn mousekeys on, then control the cursor as follows:

NUM 1, 2, 3, 4, 6, 7, 8, 9
	Direction control
NUM 5	Click
–	Switch to right click mode. Press 5 now to right click.
/ 	Switch to left click mode
0 (INS)	Switch to select/drag mode. Now use direction control keys to select/drag stuff
. (DEL)	End select/drag

(copied from


xkbset -m

to turn mousekeys off.

Personally I find the default configuration of mousekeys to be pretty slow (meaning moving the cursor across the screen takes a lot of time). The settings can be queried with

xkbset q|grep Mouse

These values can be changed by running

xkbset ma [delay] [interval] [time_to_max] [max_speed] [curve]
xkbset ma 60 10 10 5 2

Those values work quite well for me. What every setting means and does on its own and how they work together didn't become fully clear to me even after a lot of fiddling. In the end I found the values 60 10 10 5 2 on some website (don't know which). Here is an explanation of each though.

Now there's one more thing one will discover: after some timeout mousekeys will be turned off automatically. This can be very annoying, and needn't be!

xkbset q exp

shows the timeout value and how this affects mousekeys (Upon Expiry Mouse-Keys will be: ..) By default this is Off, to set it to Unchanged run

xkbset exp =m

Well then, that covers what we need to know! Now to automate things I threw together a simple script that can be bound to some hotkeys in Openbox, which can then be used to toggle mousekeys on and off:

if [ "$(xkbset q|grep "Mouse-Keys = "|cut -d\  -f3)" = "Off" ]; then
	xkbset m ma 60 10 10 5 2
	xkbset exp =m
	xkbset -m

After finding all this out, I discovered that the mousekeys feature can also be activated by running

setxkbmap -option keypad:pointerkeys

after which it can be toggled by pressing Shift-NumLock. I didn't find out how one can then change the default values without using xkbset though, so I stick to my script smile If the default values are right for you, adding this to your Openbox autostart would be the easiest solution. You'll be stuck with the timeout too though...

I stumbled upon even other approaches, involving adding or changing files in /etc/X11 or somewhere else in the system files... if anyone knows about this, feel free to share your knowledge!

Edit: Couldn't resist a quick search... … um-pad-key says:

Create a file /usr/share/X11/xorg.conf.d/90-enable-pointerkeys.conf, with contents:

Section "InputClass"
    Identifier             "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option                 "XkbOptions" "keypad:pointerkeys"

That's what I meant... still no clue as to how to change the default values without xkbset though.

Last edited by Kaokao (2013-07-20 21:23:20)


Help fund CrunchBang, donate to the project!

#2 2013-07-20 23:44:31

Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 13,970

Re: Enabling mousekeys

Kaokao wrote:

(Added contents this post to first one, how can I delete this one?)

Done. cool


Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo