diff --git a/settings/quickshell.nix b/settings/quickshell.nix index efaf110..55a1760 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -2988,6 +2988,19 @@ in if (a.startsWith("/")) return "file://" + a; return ""; } + // Clicking a notification jumps to the sending app: invoke its + // default action (apps use it to open the right chat/tab) and + // focus the window ourselves — misc:focus_on_activate is off, + // so the app's own activation request would be ignored. + function activateNotif(notif) { + if (!notif) return; + for (const a of notif.actions) + if (a.identifier === "default") { a.invoke(); break; } + const entry = (notif.desktopEntry || "").replace(/\.desktop$/, ""); + const m = [entry, notif.appName].filter(s => s !== "").join("|"); + if (m !== "") Hyprland.dispatch("focuswindow class:(?i)^(" + m + ")$"); + } + function toggleDropdown(dd, setupFn) { if (dd.visible && !dd.closing) { dd.animateClose(); @@ -5816,6 +5829,18 @@ in width: parent.width height: Math.max(notifPreview.visible ? 48 : 0, ncBody.height) + // First child, so the dismiss button and + // action chips still get their clicks. + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + bar.activateNotif(notifItem.modelData); + notifItem.modelData.dismiss(); + bar.closeAllDropdowns(); + } + } + // Image preview (album art, screenshot thumb…) ClippingRectangle { id: notifPreview @@ -6096,6 +6121,18 @@ in property string previewSource: bar.notifPreviewSource(toastItem.currentNotif) + // First child, so the dismiss button and action + // chips still get their clicks. + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + bar.activateNotif(toastItem.currentNotif); + toastItem.currentNotif.dismiss(); + toastItem.dismiss(); + } + } + // Image preview (screenshot thumb, album art…) ClippingRectangle { id: toastPreview