Solved Invoke xmodmap whenever a keyboard is plugged in?

Hi,

I have some small modifications of my standard keyboard layout, for which I use xmodmap in my ~/.xinitrc.

These modifications are lost when I re-connect my keyboard, which happens quite frequently since I use a Keyboard/Monitor/USB-switch gadget for multiple computers. That the keyboard modifications are lost in such a setup is a well-known limitation of xmodmap.

So, in order to solve this problem, I would like to automatically invoke xmodmap whenever a keyboard is connected. Is this possible, e.g. with devd?

Best,
Holger
 
Try inputplug. Keep in mind that some operations like undocking may create dozens of events so it's best to use file locking to prevent executing the script that many times at once.
I have put the command inputplug --command <path-to-my-script> into my ~/.xinitrc and it works perfectly.

Thanks!

Edit: My script is very minimal, just three calls to xmodmap. Furthermore, it's really just plugging in and out of the keyboard; it's not a real docking station. But thanks for your hints!
 
Back
Top