From ce9993071c656903649355f13c5ba5bb0a38b531 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 26 May 2025 00:09:09 +0200 Subject: [PATCH] notifications: middle click to dismiss --- .../modules/common/widgets/NotificationGroup.qml | 7 ++++--- .../modules/common/widgets/NotificationItem.qml | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.config/quickshell/modules/common/widgets/NotificationGroup.qml b/.config/quickshell/modules/common/widgets/NotificationGroup.qml index fa425ea9f..d96f2d8a8 100644 --- a/.config/quickshell/modules/common/widgets/NotificationGroup.qml +++ b/.config/quickshell/modules/common/widgets/NotificationGroup.qml @@ -76,12 +76,13 @@ Item { // Notification group area anchors.fill: parent interactive: !expanded automaticallyReset: false - acceptedButtons: Qt.LeftButton | Qt.RightButton + acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton onClicked: (mouse) => { - if (mouse.button === Qt.RightButton) { + if (mouse.button === Qt.RightButton) root.toggleExpanded(); - } + else if (mouse.button === Qt.MiddleButton) + root.destroyWithAnimation(); } onDraggingChanged: () => { diff --git a/.config/quickshell/modules/common/widgets/NotificationItem.qml b/.config/quickshell/modules/common/widgets/NotificationItem.qml index a5ace45d0..351f6bc2a 100644 --- a/.config/quickshell/modules/common/widgets/NotificationItem.qml +++ b/.config/quickshell/modules/common/widgets/NotificationItem.qml @@ -61,10 +61,16 @@ Item { // Notification item area DragManager { // Drag manager id: dragManager anchors.fill: root - anchors.leftMargin: -notificationIcon.implicitWidth + anchors.leftMargin: root.expanded ? -notificationIcon.implicitWidth : 0 interactive: expanded automaticallyReset: false - acceptedButtons: Qt.LeftButton + acceptedButtons: Qt.LeftButton | Qt.MiddleButton + + onClicked: (mouse) => { + if (mouse.button === Qt.MiddleButton) { + root.destroyWithAnimation(); + } + } onPressAndHold: (mouse) => { if (mouse.button === Qt.LeftButton) {