pomodoro: add a break time for 5 minutes.
This commit is contained in:
parent
b6ed6a2094
commit
7b49be2465
21
pomodoro.sh
21
pomodoro.sh
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user