Skip to content

Instantly share code, notes, and snippets.

@raidzero
Created March 3, 2014 00:32
Show Gist options
  • Save raidzero/9316346 to your computer and use it in GitHub Desktop.
Save raidzero/9316346 to your computer and use it in GitHub Desktop.
Xdialog for adjusting keyboard repeat options
#!/bin/sh
FILE=~/.tmp/kbdfile
DELAY=$1
RATE=$2
DEFAULTDELAY=`xset q | grep "auto repeat delay" | awk '{print $1" "$2" "$3" "$4}' | cut -d ':' -f2 | sed 's/ //g'`
DEFAULTRATE=`xset q | grep "repeat rate" | awk '{print $7}'`
if [ -z "$DELAY" ] || [ -z "$RATE" ]; then
Xdialog --clear --title "Keyboard Repeat Options" \
--2rangesbox "Please set your options" 15 45 \
"Repeat Delay (ms)" 0 1000 $DEFAULTDELAY \
"Repeat Rate" 0 1000 $DEFAULTRATE 2>$FILE
DELAY=`cat $FILE | cut -d '/' -f1`
RATE=`cat $FILE | cut -d '/' -f2`
fi
if [ -z "$DELAY" ] || [ -z "$RATE" ]; then
exit 1
fi
xset r rate $DELAY $RATE
Xdialog --clear --title "Success" --infobox "Keyboard repeat delay/rate to $DELAY/$RATE" 10 45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment