From fd0993b0914696b6bd3bca1489876df79392e5e2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 11 Jan 2012 18:51:45 -0500 Subject: [PATCH] calc key names on the fly to handle diff keyboards/systems --- .kde4/Autostart/xset-rate | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) 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 -- 2.39.5