Configure Extra Mouse Buttons on Linux (Ubuntu, Manjaro, Arch).(Logitech Trackball M570)

When you have extra tools or let's say extra buttons you will think about customizing their action.  

In Linux, you are in full control when it comes to customization. However, sometimes it's difficult to find the answer or an easy pathway, as required customization becomes specific.

I have been using Logitech M570 Wireless Trackball mouse for the last few years, on my MacBook Pro and my Linux machines.

Logitech M570 Wireless Trackball mouse (src: Logitech)

While in macOS it's easy through an application to customize the back and forward buttons to switch applications and open the Launchpad, In Linux, it requires digging deep and finding the right tools to do the job.

Here in this tutorial, I will explain how to configure extra mouse buttons to lunch my activity screen and display gnome application launcher.

But first, let's review some mice with extra buttons that you can customize:

  1. Logitech Wireless Trackball M570
  2. Logitech MX Master 3
  3. Logitech MX ERGO
  4. Logitech M720 Triathlon
  5. Logitech Marathon Mouse M705
  6. Logitech M585 Multi-Device
  7. Logitech MX Vertical Wireless Mouse
  8. Anker Wireless Ergonomic Mouse
  9. AmazonBasics Ergonomic Wireless PC Mouse

Now let's start oo customize the extra mouse buttons, In the begging we need to install 3 programs:

  1. xbindkeys
    xbindkeys is a tiny wrapper for Xorg's xev that reports key-codes.
  2. xdottool
    xdottool is a lightweight system utility which simulates or fake keyboard and mouse inputs.  
  3. xorg xev
    The "xev" program is small utility for Xorg that retrieve the mouse and keyboard events.

Let's install the apps on Manjaro:

$ sudo pacman -Syu xbindkeys xorg-xev xdotool

Now let's find the key-codes for the extra buttons we need to configure, here we will use: xev.

By clicking on the Event Tester window, You can get the mouse key-codes but using clicking on them. In my case it was 8 and 9.

Now, after getting the button codes we need to configure their actions, and we can do that with: xbindkeys and xdotool.

But first we need to run xbindkeys with the default configurations:

xbindkeys -f ~/.xbindkeysrc

Then let's open the configuration file and add our new shortcuts which will basically simulate keyboard buttons.


# Mouse Button #8 
# Show Gnome overview  
"xdotool key super"

# Mouse Button #9
# Show all applications
"xdotool key super+a"

Finally, restart xbindkeys

killall xbindkeys

xbindkeys -f ~/.xbindkeysrc 

Please note that you can customize the buttons to any shortcut you require, like taking a screenshot, lock the screen, switch to different keyboard layout, run commands (Alt + F2), or switch applications.

Also, you may consider using xte  tool itself instead of xdotool to configure your shortcuts, or even another tool called xvkbd

xte keys (man xte)

There are some GUI-based tools worth mentioning, Piper which does not work at all, and EasyStroke Gesture Recognition which is very useful creating mouse gestures with custom actions.

If you have any comment or addition to this post, please send us a message.


  1. Arch Linux Wiki: Keyboard input
  2. xdotool
  3. How can I map keyboard buttons to my mouse buttons?
  4. xdotool keycode:
  5. EasyStroke
  6. Useful answers:

  • Meteor is a unique open-source multi-platform full-stack JavaScript platform. To put all these in one sentence may not seem that unique, but comparing it to other JavaScript frameworks and platforms it offers unique more than building web apps. The Meteor app is consisting of a server and a client as...Read more...

  • Creating and managing databases is a critical part for any business or any development process. It also requires fair knowledge of installing, configuring and managing database engines and the managing software. While there are some cool management tools  like PhpMyAdmin (Adminer) and pgAdmn for PostgreSQL, they also require technical skills...Read more...

  • Ways Using Gmail For Business Gives You A Competitive AdvantageIf you are not already using Gmail for your business, there are many ways in which it can give you a strong competitive advantage. While plenty of people utilize Gmail everyday for personal correspondence, it additionally offers sophisticated functionality specifically for...Read more...

  • As I have been developing with Meteor for years, It was the first thing I usually install on my machine soon as I install the system which is usually Linux. On my new Apple M1, Meteor has a priority as well, but it needs a little trick. How to install...Read more...

  • Python is a cool language, soon as you finish your first projects with it, you will be hocked. It's a general purpose language and it's gaining popularity for the recent years among data scientists and data engineers. Personally, I recommend Python to newbies especially teens, not just because it has...Read more...