Skip to content

Instantly share code, notes, and snippets.

@wwwbruno
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save wwwbruno/3c70bfdeb489606fa2ec to your computer and use it in GitHub Desktop.

Select an option

Save wwwbruno/3c70bfdeb489606fa2ec to your computer and use it in GitHub Desktop.
Pomodoro Shell script
#!/bin/sh
#
# Pomodoro script.
#
# Displays an alert after 25 minutes job / 5 minutes pause.
#
# Shell script for a simple Pomodoro technic
#
# Author: Bruno Almeida <bruno@disvolvi.com>
countdown()
(
IFS=:
set -- $*
secs=$(( ${1#0} * 3600 + ${2#0} * 60 + ${3#0} ))
while [ $secs -gt 0 ]
do
sleep 1 &
printf "\r%02d:%02d:%02d" $((secs/3600)) $(( (secs/60)%60)) $((secs%60))
secs=$(( $secs - 1 ))
wait
done
echo
)
while true; do
zenity --warning --title="Let's begin!" --text="For 25 minutes, get focused!" --width="400" --height="100" &&
countdown "00:25:00" &&
zenity --warning --title="Relex!" --text="For 5 minutes, take a break!" --width="400" --height="100" &&
countdown "00:5:00"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment