here is simple pomodoro timer for linux written in bash for linux operation system.
scriptname=$(basename $0 .sh)
scriptvers='0.6'
minute=60
m_resting=5
m_working=25
s_resting=$(($m_resting*$minute))
s_working=$(($m_working*$minute))
audio_warning="/home/$USER/Audio/attention.wav"
function starting_dialog()
{
zen_dialog --title "$scriptname - $scriptvers" --question \
--text="Starting Tomatoe Timer:\
\n$m_working Mins Working/$m_resting Mins Resting."
return $?
}
function tomatoe_timer()
{
TASK=$1
LIMIT=$2
COUNT=0
while [ $COUNT -lt $LIMIT ]
do
echo $(($COUNT*100/$LIMIT))
let COUNT=$COUNT+1
sleep 1
done | zen_dialog --title="Cycles: $count_cycle" --progress --auto-close \
--text="Time to $TASK ($(($LIMIT/$minute)) Mins)...\t"
return $?
}
function zen_alert()
{
play "$audio_warning" &
zen_dialog --title="Cycles: $count_cycle" --question \
--text="Time to $1 has Finished!\nShall I Continue?"
return $?
}
function zen_dialog()
{
/usr/bin/env zenity "$@"
}
function __main__()
{
count_cycle=1
starting_dialog || exit
while true
do
tomatoe_timer "Working" $s_working
zen_alert "Working" || exit
tomatoe_timer "Slacking" $s_resting
zen_alert "Slacking" || exit
let count_cycle=$count_cycle+1
done
}
__main__
No comments:
Post a Comment