Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone tell me how to configure all the buttons on a Logitech MX 620 mouse ( under Ubuntu 12.04?

Specifically, I like to make one of them just the ctrl key (for control clicking webpages) and another one ctrl+w to close tabs. I also normally make the scroll wheel page down for each click (otherwise it hurts my arms to be scrolling so much). I make pushing the wheel to the left = pageback and pushing to the right = page forward.

I've searched for other answers to this and found something related here:

But when I posted a followup post to solve the issue, no one responded --perhaps I made the mistake of posting to a question that had been "solved." I'm not sure how I'm supposed to reopen a question that is pertinent to my question but doesn't quite solve mine.

Thank you for any help.

share|improve this question
I think this is the easiest way to get the mouse working with full functionality: – Edward Kennedy Feb 28 '14 at 22:20

You're going to need several applications for this, to install them run

sudo apt-get install xbindkeys xautomation xev  

Step 1

You need to find the button numbers for the buttons on your mouse. Run xev. You will see a litle white windows appear, put your mouse in it and press your mouse buttons (it's best to do this one button at a time). You should get output like this for each button:

ButtonRelease event, serial 41, synthetic NO, window 0x4c00001,
root 0x2e9, subw 0x4c00002, time 25804905, (31,28), root:(821,80),
state 0x110, button 1, same_screen YES

(note: xev also capture mouse movement so you might need to sift through mouse movement events to find your button events; e.g.: xev -event mouse | grep Button --before-context=1 --after-context=2)

This is what is important from that output: button 1. That tells us that particular button is button one. I would store this in a .txt file for now.

Step 2

Create the xbindkeys config file using:

xbindkeys --defaults > $HOME/.xbindkeysrc  

Next we need to add the key/button bindings to the config file. You can open this file with gedit $HOME/.xbindkeysrc. This is where the fun begins. We are going to use xte to set bindings to our buttons.

To make a button act as Ctrl we would add:

"xte 'key Control_L'"

This would bind Ctrl to mouse button one.

If you will tell me the button numbers of your buttons and what you want each to do, I will write the script for you.

share|improve this answer
You made my day, thank you very much. – nana Sep 26 '13 at 14:29
@seth: I would like to configure buttons 8 & 9 to be "back" and "forward" respectively. Better yet, if I could figure out where to fint the commands that I can configure with xbindkeys, that would be great. Thanks, Dan – dbbd Jun 26 '14 at 9:46
The easiest way to reduce the insanity of the xev output is by running the output through grep: xev | grep -A2 ButtonPress ; this will leave all the mouse motion events, focus events, etc. and just show the ButtonPress events. – Lambart Sep 19 '14 at 18:46
@dbbd Apparently I missed your message somehow. I will look into it and get back to you. – Seth Sep 19 '14 at 21:54
My mouse is also a G300 and I can't get this to work. The buttons are incorrectly mapped and two buttons are mapped to the same Control_L button and I have no idea how to map them since when pressed they don't identify themselves. – Inoki Sep 7 '15 at 17:17

I followed the @Seth's instructions, but the binding I wanted was to for the thumb button an the M705 to do CTRL + Left-click (for opening links in a new tab in chrome browser). The binding I needed to add was this:

"xte 'keydown Control_L' 'mouseclick 1' 'keyup Control_L'"
    b:10 + Release

It waits for the thumb button to be released, and then presses control key, performs the mouse click, then releases the control key.

share|improve this answer

I've been trying to do something similar, and I've come across this page:

Hopefully it works for mx 620 as well.

share|improve this answer

I have a Logitech MX 500 and wanted to map the lateral keys with Copy and Paste actions (it is very useful).

I used this guide to understand how to configure the xbindkeysrc file and be able to map the keys.

share|improve this answer
You know that moving the mouse pointer to the start/end of the text you want to copy and then press down the left button and keep holding it till you get to the end/start of what you want to copy and it's copied. When you want to paste you press the middle button (if you just have a two button mouse, press both left and right button at the same time) and you paste the text. No need to configure anything, this is out of the box on all Unix and Linux machines with a XWindows System. Please keep in mind we ain't using a featureless microsoft product but GNU/Linux – user350566 Nov 20 '14 at 14:29
@user350566 This kind of copy+paste has some limitations. Sometimes you want the other clipboard aka Ctrl+C / +V. Just saying. – donquixote Jan 27 at 20:09

You should install Solaar, a Linux tool that allows you to manage Logitech Unifying Receiver mice and keyboards, that comes with both a GUI and command line interface. To do that add the following repository and install by executing the following commands:

sudo add-apt-repository ppa:daniel.pavel/solaar

sudo apt-get update

sudo apt-get install solaar

This will allow you to increase and maximize you mouse's DPI, monitor battery, enable smooth scrolling and side scrolling. To get the multi window and zoom button working you can visit this site which walks you through the easy steps to get the functionality you are looking for:

share|improve this answer
I did this on my C720/crouton. When I ran solaar, it crashed back to the start screen. I had to restart (and figure out the command was sudo startxfce4) and removed solaar. – marty cohen May 15 '14 at 22:44
Solaar was very buggy for me on 14.04 and eventually just wouldn't run at all. I realize the original question was about 12.04, but thought it was worth mentioning. Maybe save someone some time. – moss Jan 24 '15 at 0:49
-1. This answer does not answer the question. solaar does not do any mapping of the mouse buttons. – Twifty Apr 19 '15 at 4:43
didnt work for me either. – Woeitg Feb 12 at 7:24

in Debian you have a xbindkeys-config package which will help you configure your key/button bindings. So do:

sudo apt-get install xbindkeys-config
share|improve this answer
That program just crashes whenever I try to do anything with my G300. – Inoki Sep 7 '15 at 17:02

Lomoco is included in Ubuntu Software Center and specifically is designed to deal with Logitech Mouse vendor-specific customizations. It can possibly accomplish some of the things you are trying to do.

share|improve this answer

So I have been using my performance MX on my ubuntu machine for about 6 months. I left most buttons default, but I did go ahead and make the thumb button the Super key which is handier than going to the top left corner of the screen in gnome. And I made the zoom button a control button. But it is set to turn on CTRL and turn off CTRL with separate clicks. This really helps since I have one 4K display and one 1080, so I can click the zoom button once, scroll the wheel to zoom in and out fo web pages, and when I have the web page scaled how I want, I click the zoom again. Here is my xbindkeysrc settings:

"/usr/bin/xte 'keydown Control_L' &"
"/usr/bin/xte 'keyup Control_L' &"
Control + b:13
"/usr/bin/xte 'key Super_L'"
b:10 + release
share|improve this answer
This doesn't seem to answer the question asked. – Zacharee1 Nov 12 '15 at 2:27

For anyone who wants to bind copy and paste actions to mouse buttons:

  1. Follow Seth answer (the one with Step 1, Step 2 and sudo apt-get install xbindkeys xautomation xev)
  2. Put following lines in your .xbindkeysrc file:

This is for copying:

"xte 'keydown Control_L' 'key c' 'keyup Control_L'"

This is for pasting:

"xte 'keydown Control_L' 'key v' 'keyup Control_L'"

*b:9 means button 9 on the mouse (check button numbers with xev)

  1. It won't work right away, you must reload .xbindkeysrc first or restart your machine.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.