aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2019-04-07 20:36:26 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2019-04-13 11:57:59 +0200
commitc8d53972148e7713e40779e75c1932cacffd526c (patch)
treeee5a6ecfc787931bd8f262c5b19c26b828df76cf
parenta5d8ca5cbf21f64f8e1f465fcca56ef916ea717b (diff)
downloadcalcurse-c8d53972148e7713e40779e75c1932cacffd526c.tar.gz
calcurse-c8d53972148e7713e40779e75c1932cacffd526c.zip
Fix daemon notification for short warning periods
When the warning period for notifications is less than 60 seconds (DAEMON_SLEEP_TIME), the daemon may be at sleep when the appointment comes up. If that happens, no notification is launched. In stead, the daemon should launch the notification early. Addresses GitHub issue #204, part 2. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rw-r--r--src/dmon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dmon.c b/src/dmon.c
index dc8aa0c..0772394 100644
--- a/src/dmon.c
+++ b/src/dmon.c
@@ -188,8 +188,9 @@ void dmon_start(int parent_exit_status)
DMON_ABRT(_("error loading next appointment\n"));
left = notify_time_left();
- if (left > 0 && left <= nbar.cntdwn
- && notify_needs_reminder()) {
+ if (left > 0 &&
+ left <= MAX(DMON_SLEEP_TIME, nbar.cntdwn) &&
+ notify_needs_reminder()) {
DMON_LOG(_("launching notification at %s for: \"%s\"\n"),
nowstr(), notify_app_txt());
if (!notify_launch_cmd())