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?