pomodoro: add a break time for 5 minutes.

This commit is contained in:
gardouille 2015-10-18 12:41:38 +02:00
parent b6ed6a2094
commit 7b49be2465

View File

@ -2,7 +2,8 @@
TIME=0
# Work on the task (default: 25 min)
DELAY=25
WORK_TIME=25
BREAK_TIME=5
# Log informations
LOG_DIR="${HOME}/.pomodoro"
@ -31,15 +32,25 @@ fi
# Start working
startedTime=$(date +"%H:%M")
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
# Tiny timer
while [ "${TIME}" != "${DELAY}" ]
do
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
sleep 1
while [ "${TIME}" != "${WORK_TIME}" ]; do
sleep 60
TIME=$((TIME+1))
printf '%b' "${TASK_NAME}\n${TIME}" > "${TASK_PATH}"
done
# Write logs
printf '%b' "$(date +"%A (%F) $startedTime → %H:%M") $TASK_NAME" >> "${LOG_TASK_PATH}"
# Start break
printf '%b' "BREAK\n${BREAK_TIME}" > "${TASK_PATH}"
while [ "${BREAK_TIME}" > 0 ]; do
sleep 60
BREAK_TIME=$((BREAK_TIME-1))
printf '%b' "BREAK\n${BREAK_TIME}" > "${TASK_PATH}"
done
exit 0