From a9b89e771ee8bd149c431543626ab929ab93eda2 Mon Sep 17 00:00:00 2001 From: JPratama7 Date: Sun, 27 Jul 2025 22:09:39 +0700 Subject: [PATCH] feat: add right-click toggle for notification silence mode with icon state --- Widgets/Notification/NotificationIcon.qml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Widgets/Notification/NotificationIcon.qml b/Widgets/Notification/NotificationIcon.qml index 6af48c6..988483a 100644 --- a/Widgets/Notification/NotificationIcon.qml +++ b/Widgets/Notification/NotificationIcon.qml @@ -7,12 +7,20 @@ import qs.Components Item { id: root width: 22; height: 22 + property bool isSilence: false + + // Process for executing CLI commands + Process { + id: rightClickProcess + command: ["qs","ipc", "call", "globalIPC", "toggleNotificationPopup"] + } // Bell icon/button Item { id: bell width: 22; height: 22 Text { + id: bellText anchors.centerIn: parent text: notificationHistoryWin.hasUnread ? "notifications_unread" : "notifications" font.family: mouseAreaBell.containsMouse ? "Material Symbols Rounded" : "Material Symbols Outlined" @@ -25,7 +33,20 @@ Item { anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onClicked: notificationHistoryWin.visible = !notificationHistoryWin.visible + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: function(mouse): void { + if (mouse.button === Qt.RightButton) { + root.isSilence = !root.isSilence; + rightClickProcess.running = true; + bellText.text = root.isSilence ? "notifications_off" : "notifications" + } + + if (mouse.button === Qt.LeftButton){ + notificationHistoryWin.visible = !notificationHistoryWin.visible + return; + } + + } onEntered: notificationTooltip.tooltipVisible = true onExited: notificationTooltip.tooltipVisible = false }