Difference between revisions of "Use Additional Mouse Buttons"

From LinuxMCE
Jump to: navigation, search
(Howto: Make additional mouse-buttons behave as F6, F7, F8 (http://forum.linuxmce.org/index.php?topic=2549.0))
Line 3: Line 3:
[[Category: Input]]
[[Category: Input]]
[[Category: Tutorials]]
This is an article, explaining how to use additional mousebuttons as substitude to F6, F7, F8.
This is an article, explaining how to use additional mousebuttons as substitude to F6, F7, F8.

Revision as of 13:46, 29 October 2007

Abstract This is an article, explaining how to use additional mousebuttons as substitude to F6, F7, F8.

This way, LinuxMCE can be controlled with a (wireless) mouse only, without the need to have a keyboard nearby...


First of all, we need the packets xautomation (which should be installed allready) and xbindkeys.

Before installing them, wen need to append "deb http://archive.ubuntu.com/ubuntu/ feisty universe" to /etc/apt/sources.list temporarely and resync the repository (see Editing_Text).

#get a console:
sudo nano -w /etc/apt/sources.list
#add the following:
deb http://archive.ubuntu.com/ubuntu/ feisty universe
#CTRL+X and Y to exit and save
#update the repository
sudo apt-get update
#Remember to remove the line afterwards and do an update again

Then we need to install those 2 packets:

#get a console:
sudo apt-get install xbindkeys
sudo apt-get install xautomation

How it works

We use xautomation (xte) to simulate the key-presses: If you want to send a keypress of F6 to the X-Server, the command "xte 'key F8'" will do the trick. If you only want to send that the key was pressed, call "xte 'keydown F8". additionally you can event move the mouse or do clicks with it. For more information have a look at "man xte".

To catch the keypresses on the mouse, we use xbindkeys. The syntax of the config-file is:

   control+shift + q

so within the "" is the command to call and below is the key to bind the command to. possible keys are control, shift, alt, ... and for mouse-buttons b:1, b:2, b:3, ...

Configuring it

Combining those two, we derive the following configfile, which i saved at /etc/xbindkeysrc:

#get a console
sudo nano -w /etc/bindkeysrc
#Add the following
"xte 'keydown F6' &"
"xte 'keyup F6' &"

"xte 'keydown F7' &"
"xte 'keyup F7' &"

"xte 'keydown F8' &"
"xte 'keyup F8' &"
#Close it with CTRL+X and Save with Y

Then we still have to start xbindkeys within the X-Server... As I do not know LinuxMCE too well, I just looked for some good spot and /usr/pluto/bin/lmce_launch_manager.sh seemed to be one. Now it looks like this:

#get a console
sudo nano -w /usr/pluto/bin/lmce_launch_manager.sh
#add the line with xbindkeysrc
xbindkeys -f /etc/xbindkeysrc      #<--- the added stuff

#CTRL+X to exit ans Y to save


After a reboot, the mouse-buttons 8, 2 and 9 should act as F6, F7 and F9 even passing when a key is held pressed, which was the right setup for me. If you want something different, just change b:9 for b:6 for example.

If you don't know the numbers of your mousebuttons, start the "application" xev. Click into the small black box and look at the console for the output "ButtonPress event, .... button X".


In case you do not get all the buttons of your mouse, e.g. 8 and 9 report as being 1 and 2 (that was the case with my mouse), try replacing the following in /etc/X11/xorg.conf

Option          "Protocol"              "ImPS/2"


Option          "Protocol"              "ExplorerPS/2"