Vincent Lefevre <vinc...@vinc17.net> writes: > In the past, I wrote a script, put in the /etc/pm/sleep.d directory: > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633849#92 > > but there were some issues with it, as I mentioned there.
It's also not directly applicable when the issue isn't related to pm-utils or suspend or hibernate. I have the same annoyance as the OP, USB keyboard connected to a USB switch so that I can switch between my work and personal computers in my home office easily. I have an alias fk for fix keyboard which just runs xmodmap with some input, basically it sets Alt_R to Mode_switch and then maps a bunch of chars (20 total) behind mode_switch. What I see in my script where I switch the USB is a little weird. I can run xmodmap from the script but it doesn't apply the layout. No error either. I've tried to use a delay and that sometimes works but not consistently. I've also tried to monitor for changes in xmodmap output even up to a minute since that changes some time after the keyboard is plugged in, after a while Alt_R appears on the mod1 line of xmodmap output. What I found just now as I played with this is that if I have just one call xmodmap then things work. I had a leftover second call to xmodmap which makes caps to control but I don't need that with my current keyboard.