I have a mouse with lots of buttons, but it's not a mainstream make like Logitech. For Windows, I have a driver that lets me assign actions like close-window (Ctrl+W) or next-tab (Ctrl+Tab), but I don't have a Linux driver. Since Linux is so flexible, I thought perhaps there is a general way to do this, regardless of brand?
Update: Based on input from Cyrex, I installed and ran sudo apt-get install btnx
which found several but not all mouse buttons.
Found: left, right, wheel, wheelclick, thumb fwd, thumb back.
Not found: wheel left, wheel right, thumb middle button.
Vendor ID is 0x04d9, Model ID is 0xa015.
Update 2: In System>Prefs>Mouse there's a lightbulb icon for testing double-click speed. Every working button can turn the bulb on&off, but the missing buttons can't. It would seem that Ubuntu isn't aware of these buttons and thus doesn't register their clicks. I guess I need to hunt for a driver, though a mainstream mouse is probably the easier way.
I have a MX Anywhere "M-R0001"
I use my forward and Back buttons as Copy and Paste.
Steps:
1) All buttons are detected with last kernel... at least with
2) So, basically, you only need to map those buttons with desired actions. How to know with button is pressed and the correspondent numeric code? Well, you can use the 'xev' program:
This program is a key and mouse events sniffer. When it's running, you can see a window in which you can press mouse buttons and see if they are detected. For example, with the zoom button of the Performance MX you will see something like that:
that means that 13 is the code for that mouse button. You can try every mouse buttons on your hand ... for easy access, here is the map for Performance MX:
the other buttons are well recognized and you don't need to map to actions.
3) Now, you need to install a little program to re-map mouse and keyboard inputs. The magician is 'xbindkeys' ... the easy installation is using:
4) Once installed, you can do the magic. The idea is configure the mouse buttons to send key combinations to activate other desktop functionalities (as the matter of fact, xbindkeys can be used for execute any other program when you press a mouse button). In KDE you can do that with Ctrl+F10 keys combination. The point is create a xbindkeys' configuration file to do the job.
5) To create the configuration file, just run the following command:
6) And we need to edit the file to specify your button's mapping:
7) We need to add our button-to-key configurations. For example, I have the following:
8) There was a new requirement. the 'xte' program, which basically simulates user key press combinations. Install it using:
Now, if you run on a terminal something like:
that means simulate a Ctrl+F10 keypress. The idea is using xbindkeys to say: "when I press 13th mouse button, send a Ctrl+F10 keyboard press using xte program to generate that"
9) And finally, you need to configure 'xbindkeys' to run automatically on system startup. Startup Applications / Add program button and type '/usr/bin/xbindkeys' on the dialog.
DONE
Easystroke is a Mouse gesture-recognition application and mouse gesture manager for Ubuntu and Other Linux distribution. it allows user to control ubuntu application with hand drawn mouse gestures or Draw on the Screen. Easystroke work on Tablet PCs, it can be used equally well with a mouse, pen, or even your fingers if you have a touch-sensitive screen.
Install Easystroke in Ubuntu
If you want installing easystroke via PPA, you can adding a PPA repository, type this command:
For Unity Users : EasyStroke have not used indicator applet yet, so when you run it from menu, you have nothing on Indicator Applet. To solve this problem, simply run these command in terminal:
It will run EasyStroke and open configuration windows automatically.
Source
If all buttons are detected correctly then you can install btnx:
sudo apt-get install btnx
ORsudo aptitude install btnx
Then go to: Applications -> System Tools -> Btnx
It has support for many types of mice
Easystroke Gesture Recognition is designed primarily for creating custom pointing device gestures, but it can also be used to assign actions to simple button presses.
To use it in this manner,
In Preferences ▸ Behavior ▸ Additional Buttons ▸ Add, select Instant Gestures and then press the desired mouse button in the gray box.
In Actions, click Add Action.
Double-click in the Stoke column and then press the desired mouse button again.
Click in the Name, Type and Details columns to set up an action.
If you install the CompizConfig Settings Manager then you will be able to set a lot of window management mouse button shortcuts.
It may take some effort working out which button is which.
In the screenshot I am assigning opening the Super+Tab switcher to a left-click of my scroll wheel.
Olli Salonen has his own ppa which needs to be added to your list if you want to install via apt. Here is the info about adding ppa.
https://launchpad.net/~daou/+archive/ppa
Also, this link might help with installing on newer version of Ubuntu since I see Olli isn't active for quite a while now.
Source is here: http://github.com/cdobrich/btnx.git It built and ran on my Linux Mint 13 without problems. Caveat: btnx-config needs to be run with root perms.
Btnx is available for download from here.
In mid-2017, there doesn't seem to be any updated btnx package for Ubuntu 16.04 LTS, and easystroke also doesn't seem to be maintained any longer.
I wanted to assign copy / paste to the two additional buttons of my (decades-old, but battle-tested) Microsoft IntelliMouse, and finally settled on imwheel, which is described in this page in the Ubuntu Wiki.
For reference, here's my
~/.imwheelrc
:To start the tool together with the X server, set
IMWHEEL_START=1
in/etc/X11/imwheel/startup.conf
.Accepted answer is outdated, here is the updated version.
You should already have these as they should come with Ubuntu, but run this just in case.
Now, download & install
1) btnx-config 2) btnx In this order.
To install:
Unzip, and
cd
into each of these folders.In each of them run:
Once both of them are installed, run
In Configurations tab, click Detect Mouse & Buttons
In Buttons tab, assign your mouse button a key or functionality. Make sure you ☑ check mark enabled.
Lastly, in Configurations tab, click on Restart btx button so your changes take effect.