[libnotify] notify-send: Add explicit option to create transient notifications



commit ed43da3479c8a2ebbaf49262a1c97da9fabbef77
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Wed Apr 27 20:52:48 2022 +0200

    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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]