diff options
-rw-r--r-- | journal-notify.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/journal-notify.c b/journal-notify.c index 63cc601..413f6d8 100644 --- a/journal-notify.c +++ b/journal-notify.c @@ -161,10 +161,20 @@ int main(int argc, char **argv) { /* show notification */ if (have_regex == 0 || regexec(®ex, message, 0, NULL, 0) == 0) { - if ((rc = notify(summary, message, icon)) < 0) { - fprintf(stderr, "Failed to show notification.\n"); - goto out40; + for (i = 0; i < 3; i++) { + if ((rc = notify(summary, message, icon)) == 0) + break; + + fprintf(stderr, "Failed to show notification, reinitializing libnotify.\n"); + notify_uninit(); + usleep(500 * 1000); + if (notify_init(program) == FALSE) { + fprintf(stderr, "Failed to initialize notify.\n"); + rc = EXIT_FAILURE; + } } + if (rc != 0) + goto out40; } free(summary); |