8

I have a new mouse which runs on bluetooth, but I had to setup the middle mouse button manually using xinput --set-button-map. This isn't persistent after reboot, so I wrote a small python script to run it automatically after login. Unfortunately, it doesn't work because there is some delay before the mouse automatically reconnects after login.

I thought of just adding some wait into my script, but I'm sure there must be a better way to do this. Can I hook into connect events from /usr/sbin/bluetoothd or something like that instead?

wim
  • 13,088

2 Answers2

9

I put some wait time and retries into my script and lived with that for a few days, but this weekend I had some spare time to find the "correct" solution.

That is, add the button map into a config file for X.

#/usr/share/X11/xorg.conf.d/logitech-mx-revolution.conf

Section "InputClass"
    Identifier  "Logitech MX Revolution Mouse"
    Option  "ButtonMapping" "1 2 3 4 5 6 7 9 8 10 11 12 13 14 15 2 17 18 19 20 21 22 23 24"
EndSection

Hopefully this helps someone else one day.

wim
  • 13,088
1

I have a Logitech Ultrathin Touch and I got the remapping to work with:

/etc/X11/xorg.conf.d/10-evdev.conf # # custom for logitech ultrathin mouse

Section "InputDevice"
    Identifier "Logitech bluetooth Touch Mouse"
    Driver "evdev"
    Option "Name"   "Ultrathin Touch Mouse"
    Option "ButtonMapping" "1 1 3 4 5 6 7 0 0 0 0 0 0"
EndSection


Section "InputClass"
    Identifier  "Ultrathin Touch Mouse"
    Option "ButtonMapping" "1 1 3 4 5 6 7 0 0 0 0 0 0"
EndSection

Not sure if all of this is needed but after a day of wrestling with this i'm just relieved that something works... I've found now that horizontal scrolling is a little slower than i'd like. so i'll probably see if there's some option to configure that.

steev
  • 239
  • 1
  • 4