Reassigning Mouse Button

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
LizC

Reassigning Mouse Button

Post by LizC »

I've been trying out Cinnamon 19 on a live usb. I use an old wacom graphire tablet mouse with a broken left button, is there a way I can assign the functions of the left button to the mouse's scroll button?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
jamesjameson

Re: Reassigning Mouse Button

Post by jamesjameson »

Hello guys,
I also am interested in solving a similar (I think) problem: my mouse works well but the central button has not a function associated. I would like that clicking the central button a application starts (a screenshot application).
I didn't find a recent post to how to assign mouse buttons to a user function.

Here at the link below there are some (OLD) suggestions for a Ubuntu user that had the third mouse button not working... suggestions only because the button restarted working by itself and because he didn't ask exactly about reassigning a function to a mouse button:
https://forum.ubuntu-it.org/viewtopic.php?f=35&t=309882

I am a almost newbie with linux and I use:
Linux Mint 17 Cinnamon 64 bit
Kernel 3.13.0-24-generic
Last edited by jamesjameson on Fri Dec 21, 2018 1:17 am, edited 2 times in total.
jamesjameson

Re: Reassigning Mouse Button

Post by jamesjameson »

Hello,
I think I found a solution for your problem, not for mine... using xinput command.

I read it here:
https://askubuntu.com/questions/785349/ ... ing-x?rq=1

1) Open terminal
2) type "xinput", you will see your input devices and their "id=", look for the mouse
For example my mouse appear (DOUBLE, maybe receiver and mouse) as a USB receiver and could be not immediate to find it, the correct one for me is the id=8 device and you understand it by trying the command below on the probable id numbers.
3) I typed "xinput test 8" command and so you can click the buttons on the mouse and have the confirm that is the right device id

My example:

james@Intel ~ $ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=8 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=9 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Power Button id=7 [slave keyboard (3)]
↳ Logitech USB Keyboard id=10 [slave keyboard (3)]
↳ Logitech USB Keyboard id=11 [slave keyboard (3)]
↳ Eee PC WMI hotkeys id=12 [slave keyboard (3)]

james@Intel ~ $ xinput test 8
motion a[0]=1125 a[1]=1742
button press 1
button press 2
button press 3
motion a[3]=-907
button press 5
motion a[3]=-906
button press 4
motion a[0]=1124
motion a[0]=1122
motion a[1]=1741
button press 1
^Z
[14]+ Fermato xinput test 8
james@Intel ~ $


USE control+Z to stop it

We have also to understand how many buttons the system VIEWs, viewed, supported, buttons number usually is a bigger number than the real number of buttons!
I have 3 buttons and a wheel... and 24 buttons are viewed by the system! :shock:
You see it with the command "xinput list 8" where you have to change the 8 with the id you discovered in your system

james@Intel ~ $ xinput list 8
Logitech USB Receiver id=8 [slave pointer (2)]
Reporting 7 classes:
Class originated from: 8. Type: XIButtonClass

Buttons supported: 24
Button labels: "Button Left" "Button Middle" "Button Right" "Button .................


We can see the number (and the mapping) of viewed/supported button asking for the buttons map:

james@Intel ~ $ xinput get-button-map 8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
james@Intel ~ $

It shows 24 buttons and a normal mapping, as expected.


Now we know the correct id and number of viewed/supported buttons... remapping is a easy command.
IF you have 16 buttons DETECTED (not real ones) with the command above the command below should work... you have only to put the right "id" you discovered in your system (and session :evil:). As you can see you have "1" in the place of "2" so in 2 (central button) you should have 1 (first button):

xinput set-button-map id 1 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16

IF you have, in example, 10 buttons DETECTED (not real ones), delete the last ones, the "... 11 12 13 14 15 16".

The problem is that id changes everytime we reboot!
So the problem is to make an automatic script that remaps the mouse correctly on every reboot finding the right id: for you is not a problem because you have a live session and anyway you have to do this procedure everytime (or is it a persistent live USB drive distribution?!).

To automatically load a script there is a simple solution at the same link but it is based on the name of the device to capture the correct id on the booting of the PC:
https://askubuntu.com/questions/785349/ ... ing-x?rq=1

My BIG problem now is that I have 2 deviceS with the same name "Logitech USB Receiver" in the same pointer section! :|
Locked

Return to “Beginner Questions”