Subject: | [patch] Add support for passing hints to the notification server |
The attached patch adds support for hints, as defined in https://developer.gnome.org/notification-spec/. This can e.g. be used to set the notification category, urgency, transient status, etc.
Note that this patch is meant to be applied after the one I've submitted on https://rt.cpan.org/Ticket/Display.html?id=102643.
Subject: | 0002-Add-support-for-passing-hints-to-the-notification-se.patch |
From fc56108b83af0e4966ad615730d09e9bc11b865c Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Mon, 9 Mar 2015 00:46:12 +0000
Subject: [PATCH 2/2] Add support for passing hints to the notification server.
---
lib/Desktop/Notify/Notification.pm | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/Desktop/Notify/Notification.pm b/lib/Desktop/Notify/Notification.pm
index e7710e8..0ac09cb 100644
--- a/lib/Desktop/Notify/Notification.pm
+++ b/lib/Desktop/Notify/Notification.pm
@@ -60,6 +60,7 @@ sub new {
$self->{server} = $server;
$self->{id} = undef;
$self->{actions} ||= {};
+ $self->{hints} ||= {};
bless $self, $class;
}
@@ -83,7 +84,7 @@ sub show {
$self->{summary},
$self->{body},
[%{$self->{actions}}],
- {},
+ $self->{hints},
$self->{timeout} || 0,
);
$self->{server}->_register_notification($self);
@@ -135,6 +136,12 @@ element in the list is the localized string that will be displayed to the user.
A user-specified function to be called whenever an action is invoked can be
specified with L<Desktop::Notify>'s L<action_callback> method.
+=item hints
+
+Optional hints that can be passed to the server from the client program.
+
+=back
+
=item timeout
The timeout time in milliseconds since the display of the notification at which
@@ -155,12 +162,6 @@ supported by L<Desktop::Notify> at this time
The optional program icon of the calling application.
-=item hints
-
-Optional hints that can be passed to the server from the client program.
-
-=back
-
=cut
1; # End of Desktop::Notify::Notification
--
2.1.4