summaryrefslogtreecommitdiff
path: root/modules/drawers/Panels.qml
diff options
context:
space:
mode:
Diffstat (limited to 'modules/drawers/Panels.qml')
-rw-r--r--modules/drawers/Panels.qml88
1 files changed, 88 insertions, 0 deletions
diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml
index 4ce1182..8b5a251 100644
--- a/modules/drawers/Panels.qml
+++ b/modules/drawers/Panels.qml
@@ -8,6 +8,10 @@ import qs.modules.bar.popouts as BarPopouts
import qs.modules.utilities as Utilities
import qs.modules.utilities.toasts as Toasts
import qs.modules.sidebar as Sidebar
+import qs.components
+import qs.components.controls
+import qs.components.effects
+import qs.services
import Quickshell
import QtQuick
@@ -27,6 +31,7 @@ Item {
readonly property alias utilities: utilities
readonly property alias toasts: toasts
readonly property alias sidebar: sidebar
+ readonly property alias clearAllButton: clearAllButton
anchors.fill: parent
anchors.margins: Config.border.thickness
@@ -54,6 +59,89 @@ Item {
anchors.right: parent.right
}
+ // Clear all notifications button - positioned to the left of the notification panel
+ Item {
+ id: clearAllButton
+
+ readonly property bool hasNotifications: Notifs.notClosed.length > 0
+ readonly property bool panelVisible: notifications.height > 0 || notifications.implicitHeight > 0
+ readonly property bool shouldShow: hasNotifications && panelVisible
+
+ anchors.top: notifications.top
+ anchors.right: notifications.left
+ anchors.rightMargin: Appearance.padding.normal
+ anchors.topMargin: Appearance.padding.large
+
+ width: button.implicitWidth
+ height: button.implicitHeight
+ enabled: shouldShow
+
+ IconButton {
+ id: button
+
+ icon: "clear_all"
+ radius: Appearance.rounding.normal
+ padding: Appearance.padding.normal
+ font.pointSize: Math.round(Appearance.font.size.large * 1.2)
+
+ onClicked: {
+ // Clear all notifications
+ for (const notif of Notifs.list.slice())
+ notif.close();
+ }
+
+ Elevation {
+ anchors.fill: parent
+ radius: parent.radius
+ z: -1
+ level: button.stateLayer.containsMouse ? 4 : 3
+ }
+ }
+
+ // Keep notification panel visible when hovering over the button
+ MouseArea {
+ anchors.fill: button
+ hoverEnabled: true
+ acceptedButtons: Qt.NoButton
+ onEntered: {
+ if (notifications.content && Notifs.notClosed.length > 0) {
+ notifications.content.show();
+ }
+ }
+ onExited: {
+ // Panel will be hidden by Interactions.qml if mouse is not over panel or button
+ }
+ }
+
+ Behavior on opacity {
+ Anim {
+ duration: Appearance.anim.durations.expressiveDefaultSpatial
+ easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
+ }
+ }
+
+ Behavior on scale {
+ Anim {
+ duration: Appearance.anim.durations.expressiveDefaultSpatial
+ easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
+ }
+ }
+
+ opacity: shouldShow ? 1 : 0
+ scale: shouldShow ? 1 : 0.5
+ }
+
+ Notifications.NotificationToasts {
+ id: notificationToasts
+
+ panels: root
+
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.topMargin: Config.border.thickness
+ anchors.rightMargin: Config.border.thickness
+ }
+
Session.Wrapper {
id: session