quickshell: hide toast when app withdraws notification

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-25 20:09:16 +00:00
parent 5ffe5d22e4
commit 5bd5bd2b90

View file

@ -7082,6 +7082,17 @@ in
}
}
// Apps withdraw their own notifications — Vesktop closes
// one the moment it lands if its window is focused. The
// object dies right after, which left an empty card up
// for the full timeout.
Connections {
target: toastItem.currentNotif
ignoreUnknownSignals: true
function onClosed() { if (toastItem.toastOpen) toastItem.hideNow(); }
}
onCurrentNotifChanged: if (!currentNotif && toastOpen) hideNow()
function showToast(notification) {
currentNotif = notification;
visible = true;
@ -7161,9 +7172,10 @@ in
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
bar.activateNotif(toastItem.currentNotif);
if (toastItem.currentNotif) toastItem.currentNotif.dismiss();
const n = toastItem.currentNotif;
bar.activateNotif(n);
toastItem.dismiss();
if (n) n.dismiss();
}
}
@ -7215,7 +7227,7 @@ in
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: { toastItem.currentNotif.dismiss(); toastItem.dismiss(); }
onClicked: { toastItem.dismiss(); if (toastItem.currentNotif) toastItem.currentNotif.dismiss(); }
}
}
}