Advanced Linux Mouse Configuration Made Easy

logitech-mouseThose of you using a mouse with multiple buttons, such as the one shown here, probably already know how painful it can be to make it work just as you’d like on Linux. I have myself been postponing the configuration of my Evoluent VerticalMouse for years. I recently gave myself a little kick in the butt, and came up with the following solution.

Identify your mouse

First, find the exact name of your, and copy it somewhere for later use:

xinput list

Mine is: “Evoluent VerticalMouse 4”

Learn your mouse’s buttons’ positions

Install xev if not already installed:

sudo apt-get install xev

Open a terminal, and run xev from the command line. A small white window will open. Put your mouse in that window, and try clicking one of your mouse’s buttons. You will get a lot of output for every click. You need to find a block that looks like this, the most important part being near the end (button 3 in this case):

ButtonPress event, serial 36, synthetic NO, window 0x3c00001,
 root 0x269, subw 0x3c00002, time 14058208, (44,38), root:(1725,240),
 state 0x10, button 3, same_screen YES

Now you can easily write down the number associated to every button of your mouse.

Choose the right order for your buttons

We will use xinput to change the button mapping. Starting with the button map you have just written down, you can easily swap buttons to match your preferences. For example, here’s what I had at first (my mouse has three buttons like in the old times, and two thumb buttons) :

  1. Left click
  2. Middle click (paste selected text in Linux)
  3. Right click
  4. Wheel scroll up
  5. Wheel scroll down
  6. ?
  7. ?
  8. Upper thumb click (back)
  9. Wheel click (forward)
  10. Lower thumb click

Here’s what I wanted :

  1. Left click (1)
  2. Right click (3)
  3. Forward (9)
  4. Wheel scroll up (4)
  5. Wheel scroll down (5)
  6. ?
  7. ?
  8. Back (8)
  9. Paste selected text (2)
  10. Lower thumb click (unused… 10)

In my case, the xinput command looks like this:

xinput -set-button-map "Evoluent VerticalMouse 4" 1 3 9 4 5 6 7 8 2 10

You can run this command in the terminal to test if your configuration works well. You can always come back to default with :

xinput -set-button-map "Evoluent VerticalMouse 4" 1 2 3 4 5 6 7 8 9 10

Make your command run at startup

We’re almost done… Now create a file in your home directory with a name something like .mouse_config, and paste your xinput command in it. Open the automatic startup program that comes with your OS. Its name in Ubuntu 12.04 is Startup Applications. Add a new entry that points to your script, add a name and a description if you want to, and that’s it! Enjoy a perfectly working mouse!

5 Comments

  1. Dave

    Thanks for the instructions. Well written and thorough! Only change in the above is that my mouse name listed as “Kingsis Peripherals Evoluent VerticalMouse 4”, so I had to make that change in the coding you listed above.

  2. Taslim

    Does not work

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package xev

    • Matt

      Hi Taslim

      I’m affraid this article is getting guite old… o almost 7 years old in fact. Much has changed since it’s been written. If you haven’t already fixed your problem, I suggest you hit sites like StackOverflow or the Ubuntu Community Hub. Experts there should be able to help you.

      Thanks for stopping by though!

  3. Eric

    Hey Matt. I have been trying to get my Evoluent Vertical Mouse 4 to work with Linux Mint 19, and I think maybe I can except for one thing. When I run xev, the back and forth browser buttons do nothing. It is like they do not appears to be able to work on Linux at all. I would love to be able to go back especially. I also have problems with the wheel that I have not yet started researching. Normally you can program these mice to scroll at warp speed. Now they are slower than molasses. Any tips on how I can get these two buttons with work? Will I ever be able to get my mouse wheel to work faster/ Thanks for any assistance. Much appreciated.

    • Matt

      Hi Eric. Unfortunately, my Evoluent Mouse gave up on me about 2 years ago.

      If that’s any help, I’m currently using this mouse (link below). It’s not exactly vertical, but it’s the best I could find at 55-60 degrees. I’m on Ubuntu 19.10 and it’s working great so far. I only had it for 4 months though. It may well start breaking apart anytime soon. :-p At some point, I got tired of buying $100+ mice that don’t last anyway. It’s sad because the Evoluent Mouse is by far my favourite mouse ever.

      https://amzn.to/38gBqnl

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2020 Evil Coding Monkey

Theme by Anders NorenUp ↑