I know I can use
xinput to disable my mouse and keyboard, and I usually type three commands every time I plug in my keyboard and mouse to my keyboard:
xinput float 'AT Translated Set 2 keyboard' xinput float 'Ideapad extra buttons' xinput float 'SynPS Synaptics Touchpad'
I usually use the id values instead of the names but you get what I mean.
So is there any way I can automate it, so whenever my keyboard is plugged in, my computer will run the top two commands, and when my mouse is plugged in, my computer will run the bottom command? Same with re-enabling the devices when my mouse/keyboard is unplugged by running