Use Additional Mouse Buttons

From LinuxMCE
Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information

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...


From 810 and onwards, you should not use this method, but instead create a device template for your mouse. The orbiter can map additional mouse buttons to other events, like keyboard presses. See The Mapping device data for details.


Edit: in the troubleshooting area you find a link to an other page that describes a different way of programming the buttons for if this procedure is not working for you.


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

Before installing them, wen need to append "deb 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 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 F8 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/xbindkeysrc
#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/ seemed to be one. Now it looks like this:

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

#CTRL+X to exit and Y to save


After a reboot, the mouse-buttons 8, 2 and 9 should act as F6, F7 and F8 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"

Other solution

In case you cannot get this to work using this procedure there is another way to accomplish the additional buttons by using BTNX software. You can find this on the Logitech_MX_Air page.