Customize mouse M560 on linux

I bought a new Logitech mouse, the M560 wireless. What I wanted was that two keys of my mouse are ”History Forward” and ”History backward” action in my browser. Unfortunately, Logitech Inc. does not provide a sufficient linxu driver. Therefore, I had to customize the ouse on my onw, which tooks a bit of research.

Needed packages

  • xbindkeys
  • xautomation

Install these tools eihter with (Fedora) dnf install xbindkeys xautomation or (Debian)
apt-get install xbindkeys xautomation

Configurate xbindkeys

  1. To find out which keys on the mouse are the forward and backwards buttons. The programm xev does this job.. Execute xev | grep button and click in the opened window. The number after the word button is the button number.xev output
  2. Configure the xbindkeys configuration. To do so, execute
    xbindkeys --defaults ~/.xbindkeysrc
  3. Open the file .xbindkeysrc. The History forward and backward action can be achieved with the keyboard combination Alt + Right and Alt + Left. So a click on the mouse button (in my case number 10 and 11) should send this signal. Thats were the programm xte comes into play. In the opened file, the following lines have to be added:
    "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'"
    b:11
    "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L'"
    b:10
    The first two lines associate the button nr 11 to the history back action. The second line thas the sam ewith the history forward action.
    Save the file.
  4. To test the configuration, execute xbindkeys -n -v
  5. . This will start xbindkeys non-daemonized with a verbose output. To start xbindkeys normally, execute xbindkeys

  6. Set xbindkeys to the autostart. One possibility is to add a desktop-file in ~/.config/autostart/.
    [Desktop Entry]
    Name=xbindkeys
    GenericName=xbindkeys
    Comment=Start xbindkeys at login
    Exec=/usr/bin/xbindkeys
    Terminal=False
    Type=Application
    X-GNOME-Autostart-enabled=true

 

 

Links

A lot of information are gained through the following links

  • https://wiki.ubuntuusers.de/xbindkeys
  • https://ask.fedoraproject.org/en/question/59485/fedora-21-doesnt-come-with-gnome-session-properties/