From 24ec8182356a4d4a8f120c3bcaaf47adfc2a619f Mon Sep 17 00:00:00 2001 From: Stel Abrego Date: Wed, 17 May 2023 20:13:40 -0700 Subject: [PATCH] Fix inaccurate notifications issue 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. --- pomo.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/pomo.sh b/pomo.sh index ed83e17..b0da249 100755 --- a/pomo.sh +++ b/pomo.sh @@ -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; }