#!/bin/sh

cfgfile=`xsetrcv wcfg`

nexts=
while [ x$nexts = x ]; do

accel=`xset q |grep acceleration |sed 's/acceleration://' |sed 's/[/][^;]\+//' \
|sed 's/ //g'`
threshold=`xset q |grep acceleration |sed 's/[^;]\+ threshold://' |sed 's/ //g'`

eval `dml "<meta title='Mysz'><br><br> \
Acceleration <input width=6 id=acc caption=$accel>   \
Threshold <input width=6 id=thre caption=$threshold> <br><br><br><br>\
  <button caption=Ustaw> \
  <button caption=Default id=default> \
  <button caption=Anuluj id=end><br><br>"`

if [ X$default = Xyes ]; then
    xset m default
else
    nexts=1
fi
done

if [ X$end = Xyes ]; then
    exit 0
fi

xset m $acc $thre

cat $cfgfile |sed 's/m_accel=//' |sed 's/m_threshold=//' |grep = >$cfgfile

echo "m_accel=$acc" >>$cfgfile
echo "m_threshold=$thre" >>$cfgfile
