Using Linux Mint 18.1, I've remapped some mouse and keyboard keys using 'xinput' (command below). When I disconnect the mouse and reconnect it, the xinput command must be re-run manually.I had read that adding them to ~/.xsessionrc is the right thing to do. As you can see I've done that. I've also tried ~/.xinputrc. It'll run once on bootup, but if I disconnect and reconnect the mouse, or sleep the computer, I need to re run the xinput command manually.Anyone know the right way to keep these commands always active? E.g. how can I make them persist across a device disconnect/reconnect?davidparks21@ghostmint ~ $ cat .xsessionrc# Map mouse button 8 (top right) to button 2 (top left) and vice versaxinput --set-button-map 10 1 8 3 4 5 6 7 2 9 10 11 12# Fix numeric keypad for shift-home and shift-endsetxkbmap -option numpad:microsoft
How to make xinput commands permanent
xorg;keyboard shortcuts;xinput
You can run this script, after plugging, or unplugging usb device, code will execute:while true; do state=$(lsusb) && sleep 2 && [[ $state != $(lsusb) ]] && echo Change detected, replace echo with your command; done