diff --git a/src/dbus.c b/src/dbus.c index b669b70..5b13ccf 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -262,7 +262,7 @@ static void on_notify(GDBusConnection *connection, n->raw_icon = raw_icon; n->timeout = timeout < 0 ? -1 : timeout * 1000; n->markup = settings.markup; - n->progress = (progress < 0 || progress > 100) ? 0 : progress + 1; + n->progress = (progress < 0 || progress > 100) ? -1 : progress; n->urgency = urgency; n->category = category; n->dbus_client = g_strdup(sender); diff --git a/src/dunst.c b/src/dunst.c index 56f4213..80a1400 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -154,7 +154,7 @@ int dunst_main(int argc, char *argv[]) n->appname = g_strdup("dunst"); n->summary = g_strdup("startup"); n->body = g_strdup("dunst is up and running"); - n->progress = 0; + n->progress = -1; n->timeout = 10 * G_USEC_PER_SEC; n->markup = MARKUP_NO; n->urgency = LOW; diff --git a/src/notification.c b/src/notification.c index 145e0c4..fb0bb8d 100644 --- a/src/notification.c +++ b/src/notification.c @@ -359,23 +359,23 @@ void notification_init(notification *n) MARKUP_NO); break; case 'p': - if (n->progress) - sprintf(pg, "[%3d%%]", n->progress - 1); + if (n->progress != -1) + sprintf(pg, "[%3d%%]", n->progress); notification_replace_single_field( &n->msg, &substr, - n->progress ? pg : "", + n->progress != -1 ? pg : "", MARKUP_NO); break; case 'n': - if (n->progress) - sprintf(pg, "%d", n->progress - 1); + if (n->progress != -1) + sprintf(pg, "%d", n->progress); notification_replace_single_field( &n->msg, &substr, - n->progress ? pg : "", + n->progress != -1 ? pg : "", MARKUP_NO); break; case '%': diff --git a/src/notification.h b/src/notification.h index e5250c1..b45f9fb 100644 --- a/src/notification.h +++ b/src/notification.h @@ -54,7 +54,7 @@ typedef struct _notification { bool first_render; bool transient; - int progress; /* percentage + 1, 0 to hide */ + int progress; /* percentage (-1: undefined) */ int history_ignore; const char *script; char *urls;