From 5bd5bd2b9003b7314abd2ab27606e377c5012e72 Mon Sep 17 00:00:00 2001 From: rope Date: Sun, 25 Oct 2026 20:09:16 +0000 Subject: [PATCH] quickshell: hide toast when app withdraws notification Co-Authored-By: Claude Opus 5.5 --- settings/quickshell.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/settings/quickshell.nix b/settings/quickshell.nix index 52e9450..d2c94f4 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -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(); } } } }