On 2021-12-15 16:53:54 +0000, Tim Woodall wrote: > I run the following command to switch my caps-lock to escape: > xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape' > > However, if I disconnect and reconnect my keyboard (I have a KVM switch > box so this happens quite a lot) the setting is lost.
FYI, there are bugs that were reported about 10 years ago: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=541388 "xserver-xorg: Xmodmap settings lost across suspend/hibernate" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633849 "xserver-xorg: XKB settings lost after suspend (hibernate) / resume or USB keyboard plugged in" > Before I start writing udev rules to auto reapply this setting when the > keyboard is (re)attached, is there some other, better, way to make this > setting stick? Note that this is a bit tricky as you need to remember $DISPLAY and a "xhost +si:localuser:root" is needed. 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. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)