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?

2 Answers 2

8

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.

8
  • 2
    User Configuration is supposed to go to /etc/X11/xorg.conf.d/
    – user56452
    Aug 1, 2014 at 12:28
  • 2
    @user56452 actually, since 10.10, Ubuntu does use /usr/share/ for X11 user config. (I thought the same thing, actually, so I proposed an edit for this answer. Then 3 seconds later I found that wiki page. oops!) Jul 19, 2015 at 2:18
  • 2
    @AustinAdams i dont see it. from that link: Users can continue making custom configuration in /etc/xorg.conf as usual; the .conf snippets are mainly there for the distro or hw vendor to ship default InputClass rules and custom overrides. "
    – user56452
    Jul 26, 2015 at 15:56
  • @user56452 well, this is doubly embarrassing -- you're right! On a 14.04 machine, I created /etc/X11/xorg.conf.d/, and Xorg applied a config file I placed there. (why did I doubt the manpage?!) The question, then, is if /etc/ is a better choice for user configuration than /usr/share/. In principle, I'd say "absolutely," but I don't use Ubuntu. What do you think, @wim? Jul 27, 2015 at 2:25
  • I think it's an inconsequential and trivial aspect of the issue. It seems like either location works - if /usr/share/X11 ever stops working someone can feel free to edit my answer.
    – wim
    Jul 27, 2015 at 11:07
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .