get timer to shime, really where it should be

This commit is contained in:
randomuser 2021-06-10 23:14:14 -05:00
parent 7a654466db
commit 6d6eec17c7
2 changed files with 6 additions and 57 deletions

View File

@ -18,11 +18,12 @@ sh:
cp -f scripts/urlhandle $(DESTDIR)$(PREFIX)/bin
cp -f scripts/indicate $(DESTDIR)$(PREFIX)/bin
cp -f scripts/vol $(DESTDIR)$(PREFIX)/bin
cp -f scripts/timer $(DESTDIR)$(PREFIX)/bin
ln -sf $(DESTDIR)$(PREFIX)/bin/timer $(DESTDIR)$(PREFIX)/bin/alarm
ln -sf $(DESTDIR)$(PREFIX)/bin/timer $(DESTDIR)$(PREFIX)/bin/tomato
ln -sf $(DESTDIR)$(PREFIX)/bin/timer $(DESTDIR)$(PREFIX)/bin/stopwatch
ln -sf $(DESTDIR)$(PREFIX)/bin/timer $(DESTDIR)$(PREFIX)/bin/verbosewatch
cp -f scripts/shime $(DESTDIR)$(PREFIX)/bin
ln -sf $(DESTDIR)$(PREFIX)/bin/shime $(DESTDIR)$(PREFIX)/bin/timer
ln -sf $(DESTDIR)$(PREFIX)/bin/shime $(DESTDIR)$(PREFIX)/bin/alarm
ln -sf $(DESTDIR)$(PREFIX)/bin/shime $(DESTDIR)$(PREFIX)/bin/tomato
ln -sf $(DESTDIR)$(PREFIX)/bin/shime $(DESTDIR)$(PREFIX)/bin/stopwatch
ln -sf $(DESTDIR)$(PREFIX)/bin/shime $(DESTDIR)$(PREFIX)/bin/verbosewatch
mkc:
cc progs/scream.c -o progs/scream

View File

@ -1,52 +0,0 @@
#!/bin/sh
case $0 in
*"timer"*)
[ $# -ne 2 ] && printf "specify minutes and \
seconds\n" && exit 1
sleep $(($1 * 60 + $2))
printf "your timer is done\a\n"
exit 0
;;
*"alarm"*)
[ $# -ne 1 ] && printf "specify time\n" && exit 1
ttw=$(($(date +%s --date="$1 tomorrow") - $(date +%s)))
sleep $ttw
printf "your alarm is done\a\n"
exit 0
;;
*"tomato"*)
[ $# -ne 2 ] && \
printf "specify work and rest time\n" && exit 1
counter=0
while true; do
printf "start work cycle %s\a\n" $(($counter + 1))
sleep $(($1 * 60))
printf "start rest cycle %s\a\n" $(($counter + 1))
sleep $(($2 * 60))
counter=$(($counter + 1))
done
exit 0
;;
*"stopwatch"*)
now=$(date +%s)
read var
printf "%s\n" $(($(date +%s) - $now))
exit 0
;;
*"verbosewatch"*)
min=0
sec=0
while true; do
printf "%02d:%02d\r" $min $sec
sleep 1
sec=$(($sec + 1))
[ $sec -eq 60 ] && min=$(($min + 1)) && sec=0
done
exit 0
;;
*)
printf "unknown invocation\n"
exit 2
;;
esac