From ed43da3479c8a2ebbaf49262a1c97da9fabbef77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 27 Apr 2022 20:52:48 +0200 Subject: [PATCH] notify-send: Add explicit option to create transient notifications --- tools/notify-send.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/notify-send.c b/tools/notify-send.c index 04eb770..c992180 100644 --- a/tools/notify-send.c +++ b/tools/notify-send.c @@ -191,6 +191,7 @@ main (int argc, char *argv[]) static gint notification_id = 0; static gboolean do_version = FALSE; static gboolean hint_error = FALSE, show_error = FALSE; + static gboolean transient = FALSE; static gboolean wait = FALSE; static glong expire_timeout = NOTIFY_EXPIRES_DEFAULT; GOptionContext *opt_ctx; @@ -215,6 +216,9 @@ main (int argc, char *argv[]) {"category", 'c', 0, G_OPTION_ARG_FILENAME, &type, N_("Specifies the notification category."), N_("TYPE[,TYPE...]")}, + {"transient", 'e', 0, G_OPTION_ARG_NONE, &transient, + N_("Create a transient notification"), + NULL}, {"hint", 'h', 0, G_OPTION_ARG_FILENAME_ARRAY, &hints, N_ ("Specifies basic extra data to pass. Valid types are boolean, int, double, string, byte and variant."), @@ -302,6 +306,11 @@ main (int argc, char *argv[]) notify_notification_set_timeout (notify, expire_timeout); notify_notification_set_app_name (notify, app_name); + if (transient) { + notify_notification_set_hint (notify, "transient", + g_variant_new_boolean (TRUE)); + } + g_free (body); /* Set hints */