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.

Published by

Svenn-Arne Dragly

I'm a physicist and programmer, writing about the stuff I figure out as I go.

6 thoughts on “Setting up the buttons on Logitech G500 mouse in Kubuntu”

  1. Hey! It’s awesome, I’ve been looking for it, but just a question. With the tools you mentioned can I use all the 7 extra mouse buttons for some keystroke assigment?
    Because in your code I can see only b:8;9;10 < I suppose it should work with the rest, thanks in advance 🙂

  2. Hi there

    I tried installing this, but since i have no workspaces, that might be the reason i am seeing less functionality with this enabled >P

    I would like the forward/back thumb keys to remain the same.
    Then the middle one to wither be F5 (reload webpages) or alt + F2 (for quickly running stuff).

    Then the wheel, can be pressed to wither side. Can that be configured? Under windows, with logitech software, i had the sensitivity keys changed to “ctrl +w” and “ctrl + shift + t” under chrome (for closing/restoring tabs). Maybe i can get the same for those keys with this? (those keys = the whell left/right click).

    I tried and failed to change anything 🙁

    1. Does the refresh function work if you change the .xbindkeysrc configuration to only include the following?

      # Refresh in browser
      “xdotool key F5”
      b:10 + release

      I don’t think you can change the action of the sensitivity keys, but the wheel buttons should be b:6 and b:7. You could try adding the following:

      “xdotool key control+w”
      b:6 + release
      “xdotool key control+shift+w”
      b:7 + release

      I haven’t tested this, but it might just work.

      Good luck!

      1. Yeah, after giving up i took it up again and managed to do what i wanted >P

        I hate the gui tool tho 😛

        #alt + f2
        “xdotool key Alt+F2”
        b:10 + release

        #Ctrl + w
        “xdotool key Ctrl+w”
        b:6 + release

        #Ctrl + Shift + T
        “xdotool key Ctrl+Shift+t”
        b:7 + release

        “xdotool key F5”
        Shift + b:10 + release

Leave a Reply