scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

pomodoro.sh (852B)


      1 #!/usr/bin/env sh
      2 
      3 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
      4     echo "pomdoro"
      5     echo "usage: pomodoro [OPTIONS]"
      6     echo ""
      7     echo "OPTIONS"
      8     echo "  -s, --short     Take short (5 minute breaks), default."
      9     echo "  -l, --long      Take long (15 minute breaks)."
     10     echo "  -h, --help      Print this message"
     11     exit
     12 fi
     13 
     14 NAME="pomodoro"
     15 WORK=25m
     16 BREAK=5m
     17 if [ "$1" = "--long" ]; then  BREAK=15m; fi
     18 
     19 notify-send -a pomodoro "Begin" "Work for 25m. Break for $BREAK.\nRepeat."
     20 if [ -s $? ]; then echo "notify-send failed, aborting"; fi
     21 
     22 while [ true ]; do
     23 	msg="You've been working for $WORK, time for a $BREAK break."
     24     sleep "$WORK" && notify-send -a $NAME "Take a break" $msg
     25 	echo "$msg"
     26 
     27 	msg="$BREAK break is over, back to being busy for 25m."
     28     sleep "$BREAK" && notify-send -a $NAME "Back to work" $msg
     29 	echo "$msg"
     30 done