Mousekeys: to point and click with the numerical keys

Categories:  Linux
Labels:  terminal, tutorials

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

Use

$ 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 http://abhijeetmaharana.com/blog/2007/08/31/mousekeys-on-ubuntu/)

Use

$ 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] e.g. 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:

1
2
#!/bin/bash
if [ "$(xkbset q|grep "Mouse-Keys = "|cut -d\ -f3)" = "Off" ]; then xkbset m ma 60 10 10 5 2 xkbset exp =m else xkbset -m fi

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 :) 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!

Couldn't resist a quick search... http://askubuntu.com/questions/149651/h … 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" EndSection

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

Source

Related Posts:

Social Profiles

Alvistec spanish
Plan Alvistec in Youtube
Privacy policy

This web site uses third's cookies and the Google's cookies to offer services, personalize ads and analyze traffic (Google analytics).
The information on the use of the this web site is shared with Google and another ads provider platforms. When you using this web site, you accept cookies use.
See more about the Cookies

This web accept cryptocoin donations
BTC address, LTC, ETH, Uphold:
Why donations?