pomodoro: Set a long break if the task list is modulo 4.
This commit is contained in:
parent
a9e9e83e15
commit
9050060c45
16
pomodoro.sh
16
pomodoro.sh
|
@ -4,6 +4,7 @@ TIME=0
|
||||||
# Work on the task (default: 25 min)
|
# Work on the task (default: 25 min)
|
||||||
WORK_TIME=25
|
WORK_TIME=25
|
||||||
SHORT_BREAK_TIME=5
|
SHORT_BREAK_TIME=5
|
||||||
|
# Every 4 pomodori
|
||||||
LONG_BREAK_TIME=20
|
LONG_BREAK_TIME=20
|
||||||
|
|
||||||
# Log informations
|
# Log informations
|
||||||
|
@ -16,7 +17,6 @@ TASK_NAME="${1}"
|
||||||
TASK_PATH="${LOG_DIR}/current.task"
|
TASK_PATH="${LOG_DIR}/current.task"
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
|
|
||||||
# Create the log dir
|
# Create the log dir
|
||||||
if [ ! -d "${LOG_DIR}" ]; then
|
if [ ! -d "${LOG_DIR}" ]; then
|
||||||
mkdir -p -- "${LOG_DIR}"
|
mkdir -p -- "${LOG_DIR}"
|
||||||
|
@ -50,16 +50,24 @@ while [ "${TIME}" != "${WORK_TIME}" ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Write logs
|
# Write logs
|
||||||
printf '%b' "$(date +"%A (%F) $startedTime → %H:%M") $TASK_NAME" >> "${LOG_TASK_PATH}"
|
printf '%b' "$(date +"%A (%F) $startedTime → %H:%M") $TASK_NAME\n" >> "${LOG_TASK_PATH}"
|
||||||
|
|
||||||
# Start break
|
# Start break
|
||||||
|
if [ `expr ${num} % 4` -eq 0 ]; then
|
||||||
|
BREAK_TIME=${LONG_BREAK_TIME}
|
||||||
|
BREAK_MSG="Relax"
|
||||||
|
else
|
||||||
BREAK_TIME=${SHORT_BREAK_TIME}
|
BREAK_TIME=${SHORT_BREAK_TIME}
|
||||||
printf '%b' "BREAK\n${BREAK_TIME}" > "${TASK_PATH}"
|
BREAK_MSG="Pause"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BREAK_TIME=${SHORT_BREAK_TIME}
|
||||||
|
printf '%b' "${BREAK_MSG}\n${BREAK_TIME}" > "${TASK_PATH}"
|
||||||
|
|
||||||
while [ "${BREAK_TIME}" > 0 ]; do
|
while [ "${BREAK_TIME}" > 0 ]; do
|
||||||
sleep 60
|
sleep 60
|
||||||
BREAK_TIME=$((BREAK_TIME-1))
|
BREAK_TIME=$((BREAK_TIME-1))
|
||||||
printf '%b' "BREAK\n${BREAK_TIME}" > "${TASK_PATH}"
|
printf '%b' "${BREAK_MSG}\n${BREAK_TIME}" > "${TASK_PATH}"
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue