]> git.wh0rd.org Git - home.git/commitdiff
calc key names on the fly to handle diff keyboards/systems
authorMike Frysinger <vapier@gentoo.org>
Wed, 11 Jan 2012 23:51:45 +0000 (18:51 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Apr 2012 19:36:43 +0000 (15:36 -0400)
.kde4/Autostart/xset-rate

index aa3aeb09747ea477b9b9cc0583593d5f47485c40..f174f159e0988a5eb9c5535e7c811dcddfcb3b55 100755 (executable)
@@ -1,16 +1,22 @@
 #!/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