#!/bin/sh apply_settings() { sleep 2 xinput set-prop pointer:"Logitech USB Trackball" "libinput Natural Scrolling Enabled" 1 xinput set-prop pointer:"Logitech USB Trackball" "libinput Accel Speed" 1.000000 xinput set-prop pointer:"SteelSeries SteelSeries Rival 310 eSports Mouse" "libinput Accel Speed" 0.300000 xinput set-prop pointer:"ELECOM ELECOM TrackBall Mouse" "libinput Accel Speed" 0.300000 xinput set-prop pointer:"Logitech M705" "libinput Accel Speed" 1.000000 if [ -f ~/.Xmodmap ]; then xmodmap ~/.Xmodmap; fi } apply_settings while true; do state=$(lsusb) sleep 2 if [ "$state" != "$(lsusb)" ]; then apply_settings fi done