diff options
-rwxr-xr-x | .local/bin/kb | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/.local/bin/kb b/.local/bin/kb index 29ba370..871fe01 100755 --- a/.local/bin/kb +++ b/.local/bin/kb @@ -44,16 +44,26 @@ # # Script to set the internal keyboard correctly -xset r rate 200 150 -setxkbmap -option -setxkbmap -layout us -variant intl -if [ "$(hostname -s)" = "mother" ]; then - setxkbmap -option ctrl:swapcaps - setxkbmap -option caps:none - xmodmap -e 'keycode 9 = Tab' - xmodmap -e 'keycode 23 = Escape' - xmodmap -e 'keycode 37 =' -fi -notify-send -u low -t 2000 'kb' ' Swapped Esc/Tab' +[ -z $DISPLAY ] && exit + +config_keyboard() { + xset r rate 200 150 + setxkbmap -option + setxkbmap -layout us -variant intl + if [ "$(hostname -s)" = "motherqwe" ]; then + setxkbmap -option ctrl:swapcaps + setxkbmap -option caps:none + xmodmap -e 'keycode 9 = Tab' + xmodmap -e 'keycode 23 = Escape' + xmodmap -e 'keycode 37 =' + fi + notify-send -u low -t 2000 'kb' ' Swapped Esc/Tab' +} + +config_keyboard + +inotifywait -m /dev/input -e create | while read -r a; do + config_keyboard +done # vim: filetype=sh |