Setting up the buttons on Logitech G500 mouse in Kubuntu

I’ve become very happy with the Logitech G500 mouse. I like its responsiveness, the USB connection rather than wireless (no batteries, always responsive) and how it sits in my hand.

However, setting up the keys on my Kubuntu box (Ubuntu with KDE) wasn’t straightforward. However, I’ve found a mapping that I enjoy and thought I could share it with you. You may modify it further to customize it to your needs.

The setup is such that I switch desktops with the arrow thumb buttons and activate the Desktop Grid function with the middle thumb button. Other than that, the mapping is as usual. To make this work, I’m using the xte, xdotool and xbindkeys programs. To install these, just run

sudo apt-get install xautomation xdotool xbindkeys xbindkeys-config

Then you may just paste this at the end of a file named .xbindkeysrc in your home folder:

#Present Windows
"xdotool key --delay=60 super+s"
   b:10 + release

#Previous workspace
"xte 'keydown Control_L' 'keydown Alt_L' 'key Left' 'keyup Control_L' 'keyup Alt_L'"
   b:8 + release

#Next workspace
"xte 'keydown Control_L' 'keydown Alt_L' 'key Right' 'keyup Control_L' 'keyup Alt_L'"
   b:9 + release

#Move to previous workspace
"xte 'keydown Control_L' 'keydown Shift_L' 'keydown Alt_L' 'key Left' 'keyup Control_L' 'keyup Shift_L' 'keyup Alt_L'"
   Shift + b:8 + release

#Move to next
"xte 'keydown Control_L' 'keydown Shift_L' 'keydown Alt_L' 'key Right' 'keyup Control_L' 'keyup Shift_L' 'keyup Alt_L'"
   Shift + b:9 + release

After this, you just need to start xbindkeys. Do this by running xbindkeys in a terminal (you may want to add this to your startup applications).

That’s it! You have now configured the extra buttons and should be able to click your way around your desktops. If you are having any trouble, try to launch xbindkeys-config and have a look around to see if everything is configured correctly. From there you may also test the commands or configure more buttons if you’d like to.