Fix notification replacement not always visible

This commit is contained in:
Erik Reider 2021-12-28 14:40:47 +01:00
parent 36c62c8a10
commit a72ba2e8fa

View File

@ -4,7 +4,9 @@ namespace SwayNotificatonCenter {
private unowned NotificationWindow notificationWindow {
get {
if (!notis.get_realized ()) notis = new NotificationWindow ();
if (!notis.get_realized () || notis.closed) {
notis = new NotificationWindow ();
}
return notis;
}
}
@ -39,6 +41,8 @@ namespace SwayNotificatonCenter {
private double last_upper = 0;
public bool closed = false;
public NotificationWindow () {
GtkLayerShell.init_for_window (this);
GtkLayerShell.set_layer (this, GtkLayerShell.Layer.OVERLAY);
@ -125,7 +129,10 @@ namespace SwayNotificatonCenter {
}
if (!this.get_realized ()) return;
if (box.get_children ().length () == 0) this.close ();
if (box.get_children ().length () == 0) {
this.closed = true;
this.close ();
}
}
public void add_notification (NotifyParams param,