#!/bin/sh set -e # exit on errors # KDE installs my custom keymap when I log in, but if my keyboard # crashes and reboots — or gets unplugged and plugged back in — it # resets to the default keymap. So I wrote this script to restore my # custom keymap within a second if that happens. This is almost # certainly the wrong way to solve the problem, but it's pretty easy. while : ; do # My default keymap has no Multi_key, but my custom keymap does # (on keycode 108), which is how you can tell the difference. if ! xmodmap -pk | grep -q Multi_key; then xmodmap ~/.Xmodmap fi sleep 1 done