#!/bin/bash
-keys="
- 37 #left-ctrl
- 50 #left-shift
- 64 #left-alt
- 66 #left-caps
- 115 #left-win
- 113 #right-alt
- 109 #right-ctrl
- 62 #right-shift
-"
-for x in ${keys} ; do
- [[ ${x} == "#"* ]] && continue
- xset -r $x
+
+unset xmodmap_pke
+keyname_to_keycode() {
+ : ${xmodmap_pke:=$(xmodmap -pke)}
+ echo "${xmodmap_pke}" | awk -vkey="$1" '$4 == key { print $2 }'
+}
+
+# disable repeat on some keys (randomly, they get turned on?!)
+keys=(
+ Control_{L,R} # Ctrl key
+ Shift_{L,R} # Shift key
+ Alt_{L,R} # Alt key
+ Super_{L,R} # Windows key
+ Mode_switch # Capslock
+)
+for x in ${keys[@]} ; do
+ for c in $(keyname_to_keycode $x); do
+ xset -r ${c}
+ done
done
exec xset r rate 200