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>
This commit is contained in:
Lars Henriksen 2019-04-07 20:36:26 +02:00 committed by Lukas Fleischer
parent a5d8ca5cbf
commit c8d5397214

View File

@ -188,8 +188,9 @@ void dmon_start(int parent_exit_status)
DMON_ABRT(_("error loading next appointment\n")); DMON_ABRT(_("error loading next appointment\n"));
left = notify_time_left(); left = notify_time_left();
if (left > 0 && left <= nbar.cntdwn if (left > 0 &&
&& notify_needs_reminder()) { left <= MAX(DMON_SLEEP_TIME, nbar.cntdwn) &&
notify_needs_reminder()) {
DMON_LOG(_("launching notification at %s for: \"%s\"\n"), DMON_LOG(_("launching notification at %s for: \"%s\"\n"),
nowstr(), notify_app_txt()); nowstr(), notify_app_txt());
if (!notify_launch_cmd()) if (!notify_launch_cmd())