Skip to content

Commit

Permalink
Fix inaccurate notifications issue
Browse files Browse the repository at this point in the history
The `pomo notify` command uses the the `pomo_msg` bash function which
sleeps until the current cycle portion should end. Upon waking up, it
checks `pomo_stat` for the current pomodoro state. In order to get an
accurate state, `pomo_update` needs to be called first because the
pomodoro timer may have been restarted while `pomo_msg` was sleeping.
  • Loading branch information
stelcodes committed May 18, 2023
1 parent 5a1e3f9 commit 24ec818
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pomo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ function pomo_msg {
# stat >= running + left (haven't updated timestamp) or
# stat < running (have just updated the timestamp from a
# separate pomo call, e.g. using pomo status).
pomo_update
stat=$(pomo_stat)
[[ $stat -ge $(( running + left )) ]] && break
$work || { [[ $stat -lt $running ]] && break; }
Expand Down

0 comments on commit 24ec818

Please sign in to comment.