Keyboard Layout Switch
Posted: Sun Oct 25, 2015 6:09 am
Nothing big, just a special case situation. Imagine you have a laptop with Japanese keyboard. Whenever a US keyboard is plugged, the layouts won't match. This script will help you fix it quickly (call it from ~/.xinitrc):
If you write an udev rule for it, the script can be run whenever the device is plugged in.
Code: Select all
#!/bin/bash
setxkbmap jp & # set JP first
keyb=`lsusb | grep Keyboard`
[ -n "$keyb" ] && setxkbmap us & # set US if USB keyboard found