fix(agsV2): deal with dupe notif properly
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
04003d26ee
commit
c20ec51142
1 changed files with 18 additions and 10 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue