From c20ec51142db34a551186b767b8733bcab47d475 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 12 Nov 2024 15:47:21 -0500 Subject: [PATCH] fix(agsV2): deal with dupe notif properly --- .../ags-v2/config/widgets/notifs/gesture.tsx | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/nixosModules/ags-v2/config/widgets/notifs/gesture.tsx b/nixosModules/ags-v2/config/widgets/notifs/gesture.tsx index 1d2ddf2e..644a58ea 100644 --- a/nixosModules/ags-v2/config/widgets/notifs/gesture.tsx +++ b/nixosModules/ags-v2/config/widgets/notifs/gesture.tsx @@ -123,7 +123,7 @@ export class NotifGestureWrapper extends Widget.EventBox { )); } - public slideAway(side: 'Left' | 'Right'): void { + public slideAway(side: 'Left' | 'Right', duplicate = false): void { if (!this.sensitive || this._sliding_away) { return; } @@ -156,16 +156,18 @@ export class NotifGestureWrapper extends Widget.EventBox { rev.revealChild = false; timeout(ANIM_DURATION, () => { - // Kill notif if specified - if (!this.is_popup) { - Notifications.get_notification(this.id)?.dismiss(); + if (!duplicate) { + // Kill notif if specified + if (!this.is_popup) { + Notifications.get_notification(this.id)?.dismiss(); - // Update HasNotifs - HasNotifs.set(Notifications.get_notifications().length > 0); - } - else { - // Make sure we cleanup any references to this instance - NotifGestureWrapper.popups.delete(this.id); + // Update HasNotifs + HasNotifs.set(Notifications.get_notifications().length > 0); + } + else { + // Make sure we cleanup any references to this instance + NotifGestureWrapper.popups.delete(this.id); + } } // Get rid of disappeared widget @@ -232,6 +234,12 @@ export class NotifGestureWrapper extends Widget.EventBox { }); } + this.hook(Notifications, 'notified', (_, notifId) => { + if (notifId === this.id) { + this.slideAway(this.is_popup ? 'Left' : 'Right', true); + } + }); + const gesture = Gtk.GestureDrag.new(this); this.add(