6

I have mouse Logitech M590 with some extra buttons. By default buttons 8 and 9 works as "back" and "forward". I want to give them different functionality. A followed the last answer in this thread How can I assign actions to all my mouse buttons?. I installed btnx daemon (I had to compile it on 18.04, it would not compile on 19.10). Then in btnx-config I assigned a new function - "zoom-out" and "zoom in" to buttons 8 and 9. But now one button has two functions, it is zooming in and going forward at the same time. I want them to have only one function which I assigned them in btnx-config.

How can I disable the default behavior of these buttons? I don't want to disable them completely, I still want to be able to assign them functions through btnx-config.

Jerguš
  • 751

2 Answers2

2

I advice you to use Xbindkeys utility instead. You can find a nice guide here.

In short:

  1. Install xbindkeys, preferably through your package manager.

  2. You can create a default configuration file with the command:

    xbindkeys --defaults > $HOME/.xbindkeysrc
    
  3. Open ~/.xbindkeysrc in your your favorite text editor. If you can’t find it, make sure you have Show hidden files enabled.

  4. Paste something like this on bottom of the file:

    # Back
    "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'"
     b:8
    
    # Forward
    "xte 'keydown Alt_L' 'key Right' 'keyup Alt_L'"
      b:9
    

    Here you can set any actions you want, in lines which start from xte command. Just replace buttons like Alt_L and Left/Right to get hotkeys that you want.

    b8 and b9 are codes for additional mouse buttons -- these are standart, but you can find codes for yours with xbindkeys -k command in terminal.


Also I suggest you to give a try to Easystroke utility, which has a lot of functionality for mouse gestures (including additional buttons), but it requires more digging :)

As for me, I wanted my additional mouse button to act as a Ctrl key, and I found a perfect guide here, in the 5th post.

Currently my mouse setting is:

additional button + middle click → copy,
           + right click → paste,
           + wheel scrolling → zooming,
           + left click → select multiple files in file manager.

Let me know, if you'll need help on how to set something similar in Easystroke :)

emvaized
  • 370
0

I found Autokey a useful tool to reassign functionality of keyboard keys, and it also has support for the mouse, see https://askubuntu.com/a/911195/854911

Bart
  • 111