1 |
commit: 0340f4324cc232b9357f33a5d0ed81dfbcfb093a |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 14 20:25:22 2020 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 14 20:25:32 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0340f432 |
7 |
|
8 |
gnome-extra/gnome-shell-extension-gsconnect: Avoid repeated notifications |
9 |
|
10 |
Fix WhatsApp notifications handling and avoid repetitions with backported |
11 |
fixes from upstream. |
12 |
|
13 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
14 |
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org> |
15 |
|
16 |
...-extension-gsconnect-33-avoid-repetitions.patch | 51 +++++++++++++++ |
17 |
...xtension-gsconnect-33-whatsapp-duplicates.patch | 34 ++++++++++ |
18 |
.../gnome-shell-extension-gsconnect-33-r2.ebuild | 74 ++++++++++++++++++++++ |
19 |
3 files changed, 159 insertions(+) |
20 |
|
21 |
diff --git a/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch |
22 |
new file mode 100644 |
23 |
index 00000000000..d7ed8780ee0 |
24 |
--- /dev/null |
25 |
+++ b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-avoid-repetitions.patch |
26 |
@@ -0,0 +1,51 @@ |
27 |
+--- a/src/shell/notification.js.orig 2020-05-14 13:57:38.781404129 +0200 |
28 |
++++ b/src/shell/notification.js 2020-05-14 13:57:54.335642763 +0200 |
29 |
+@@ -200,20 +200,27 @@ |
30 |
+ this._notificationPending = true; |
31 |
+ let notification = this._notifications[localId]; |
32 |
+ |
33 |
+- // Check if @notificationParams represents an exact repeat |
34 |
+- let repeat = ( |
35 |
+- notification && |
36 |
+- notification.title === notificationParams.title.unpack() && |
37 |
+- notification.bannerBodyText === notificationParams.body.unpack() |
38 |
+- ); |
39 |
+- |
40 |
+- // If it's a repeat, we still update the metadata |
41 |
+- if (repeat) { |
42 |
+- notification.deviceId = deviceId; |
43 |
+- notification.remoteId = remoteId; |
44 |
++ // Check if this is a repeat |
45 |
++ if (notification) { |
46 |
+ notification.requestReplyId = requestReplyId; |
47 |
+ |
48 |
+- // Device Notification |
49 |
++ // Bail early If @notificationParams represents an exact repeat |
50 |
++ let title = notificationParams.title.unpack(); |
51 |
++ let body = notificationParams.body ? |
52 |
++ |
53 |
++ notificationParams.body.unpack() : |
54 |
++ null; |
55 |
++ |
56 |
++ if (notification.title === title && |
57 |
++ notification.bannerBodyText === body) { |
58 |
++ this._notificationPending = false; |
59 |
++ return; |
60 |
++ } |
61 |
++ |
62 |
++ notification.title = title; |
63 |
++ notification.bannerBodyText = body; |
64 |
++ |
65 |
++ // Device Notification |
66 |
+ } else if (idMatch) { |
67 |
+ notification = new NotificationDaemon.GtkNotificationDaemonNotification(this, notificationParams); |
68 |
+ |
69 |
+@@ -237,7 +244,7 @@ |
70 |
+ this._notifications[localId] = notification; |
71 |
+ } |
72 |
+ |
73 |
+- if (showBanner && !repeat) |
74 |
++ if (showBanner) |
75 |
+ this.notify(notification); |
76 |
+ else |
77 |
+ this.pushNotification(notification); |
78 |
|
79 |
diff --git a/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch |
80 |
new file mode 100644 |
81 |
index 00000000000..7301bfe1132 |
82 |
--- /dev/null |
83 |
+++ b/gnome-extra/gnome-shell-extension-gsconnect/files/gnome-shell-extension-gsconnect-33-whatsapp-duplicates.patch |
84 |
@@ -0,0 +1,34 @@ |
85 |
+From 959799d934360f95a2e49223b64ffc77bba2736e Mon Sep 17 00:00:00 2001 |
86 |
+From: Andy Holmes <andrew.g.r.holmes@×××××.com> |
87 |
+Date: Fri, 8 May 2020 21:26:19 -0700 |
88 |
+Subject: [PATCH] Shell Notifications: account for apps that insert newlines in |
89 |
+ IDs |
90 |
+ |
91 |
+We need to account for the totally reasonable practice of inserting |
92 |
+literal newline characters in notification IDs, like WhatsApp does. |
93 |
+ |
94 |
+Not doing so was resulting in such notifications failing to match as |
95 |
+device notifications, allowing them to be duplicated in the message tray |
96 |
+ |
97 |
+closes #788 |
98 |
+--- |
99 |
+ src/shell/notification.js | 4 ++-- |
100 |
+ 1 file changed, 2 insertions(+), 2 deletions(-) |
101 |
+ |
102 |
+diff --git a/src/shell/notification.js b/src/shell/notification.js |
103 |
+index e7a5f67ce..eef623a71 100644 |
104 |
+--- a/src/shell/notification.js |
105 |
++++ b/src/shell/notification.js |
106 |
+@@ -16,10 +16,10 @@ const APP_PATH = '/org/gnome/Shell/Extensions/GSConnect'; |
107 |
+ |
108 |
+ |
109 |
+ // deviceId Pattern (<device-id>|<remote-id>) |
110 |
+-const DEVICE_REGEX = /^([^|]+)\|(.+)$/; |
111 |
++const DEVICE_REGEX = /^([^|]+)\|([\s\S]+)$/; |
112 |
+ |
113 |
+ // requestReplyId Pattern (<device-id>|<remote-id>)|<reply-id>) |
114 |
+-const REPLY_REGEX = /^([^|]+)\|(.+)\|([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i; |
115 |
++const REPLY_REGEX = /^([^|]+)\|([\s\S]+)\|([0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$/i; |
116 |
+ |
117 |
+ |
118 |
+ /** |
119 |
|
120 |
diff --git a/gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild b/gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild |
121 |
new file mode 100644 |
122 |
index 00000000000..5b9bc72ccdc |
123 |
--- /dev/null |
124 |
+++ b/gnome-extra/gnome-shell-extension-gsconnect/gnome-shell-extension-gsconnect-33-r2.ebuild |
125 |
@@ -0,0 +1,74 @@ |
126 |
+# Copyright 1999-2020 Gentoo Authors |
127 |
+# Distributed under the terms of the GNU General Public License v2 |
128 |
+ |
129 |
+EAPI=7 |
130 |
+inherit gnome2-utils meson readme.gentoo-r1 |
131 |
+ |
132 |
+DESCRIPTION="KDE Connect implementation for Gnome Shell" |
133 |
+HOMEPAGE="https://github.com/andyholmes/gnome-shell-extension-gsconnect" |
134 |
+SRC_URI="https://github.com/andyholmes/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
135 |
+ |
136 |
+LICENSE="GPL-2+" |
137 |
+SLOT="0" |
138 |
+KEYWORDS="~amd64 ~x86" |
139 |
+IUSE="nautilus" |
140 |
+ |
141 |
+COMMON_DEPEND="dev-libs/glib:2" |
142 |
+RDEPEND="${COMMON_DEPEND} |
143 |
+ app-eselect/eselect-gnome-shell-extensions |
144 |
+ >=dev-libs/gjs-1.48 |
145 |
+ =gnome-base/gnome-shell-3.34* |
146 |
+ gnome-base/gvfs |
147 |
+ gnome-extra/evolution-data-server |
148 |
+ || ( media-libs/libcanberra media-libs/gsound ) |
149 |
+ nautilus? ( |
150 |
+ dev-python/nautilus-python |
151 |
+ gnome-base/nautilus[introspection] ) |
152 |
+" |
153 |
+DEPEND="${COMMON_DEPEND}" |
154 |
+BDEPEND=" |
155 |
+ virtual/pkgconfig |
156 |
+" |
157 |
+ |
158 |
+DISABLE_AUTOFORMATTING="yes" |
159 |
+DOC_CONTENTS="For knowing more about how to do the setup, please visit: |
160 |
+https://github.com/andyholmes/gnome-shell-extension-gsconnect/wiki/Installation" |
161 |
+ |
162 |
+PATCHES=( |
163 |
+ # From 'master' |
164 |
+ # Shell Notifications: set a limit of 10 notifications from GSConnect |
165 |
+ "${FILESDIR}/${P}-notifications-limit.patch" |
166 |
+ |
167 |
+ # Don't show duplicated WhatsApp notifications and avoid repetitions |
168 |
+ "${FILESDIR}/${P}-whatsapp-duplicates.patch" |
169 |
+ "${FILESDIR}/${P}-avoid-repetitions.patch" |
170 |
+) |
171 |
+ |
172 |
+src_configure() { |
173 |
+ # nemo support relies on nemo-python from https://github.com/linuxmint/nemo-extensions |
174 |
+ # https://bugs.gentoo.org/694388 |
175 |
+ meson_src_configure \ |
176 |
+ -Dnemo=false \ |
177 |
+ $(meson_use nautilus) |
178 |
+} |
179 |
+ |
180 |
+src_install() { |
181 |
+ meson_src_install |
182 |
+ readme.gentoo_create_doc |
183 |
+} |
184 |
+ |
185 |
+pkg_preinst() { |
186 |
+ gnome2_schemas_savelist |
187 |
+} |
188 |
+ |
189 |
+pkg_postinst() { |
190 |
+ gnome2_schemas_update |
191 |
+ ebegin "Updating list of installed extensions" |
192 |
+ eselect gnome-shell-extensions update |
193 |
+ eend $? |
194 |
+ readme.gentoo_print_elog |
195 |
+} |
196 |
+ |
197 |
+pkg_postrm() { |
198 |
+ gnome2_schemas_update |
199 |
+} |