From: Mike Frysinger Date: Wed, 11 Jan 2012 23:51:45 +0000 (-0500) Subject: calc key names on the fly to handle diff keyboards/systems X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=fd0993b0914696b6bd3bca1489876df79392e5e2;p=home.git calc key names on the fly to handle diff keyboards/systems --- diff --git a/.kde4/Autostart/xset-rate b/.kde4/Autostart/xset-rate index aa3aeb0..f174f15 100755 --- a/.kde4/Autostart/xset-rate +++ b/.kde4/Autostart/xset-rate @@ -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