summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-10 19:52:35 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-10 19:52:35 +1000
commit4c892f53e842d224f55d7abbdcb3dd1520817bf4 (patch)
treea404e1a42a5c186f9062485e2ee421feaddbd36e /modules
parentnotifs: minor fixes (diff)
downloadcaelestia-shell-4c892f53e842d224f55d7abbdcb3dd1520817bf4.tar.gz
caelestia-shell-4c892f53e842d224f55d7abbdcb3dd1520817bf4.tar.bz2
caelestia-shell-4c892f53e842d224f55d7abbdcb3dd1520817bf4.zip
notifs: slide to remove
Diffstat (limited to 'modules')
-rw-r--r--modules/notifications/Notification.qml45
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/notifications/Notification.qml b/modules/notifications/Notification.qml
index a3fa171..c8a83ea 100644
--- a/modules/notifications/Notification.qml
+++ b/modules/notifications/Notification.qml
@@ -20,8 +20,48 @@ StyledRect {
color: Colours.palette.m3surfaceContainer
radius: Appearance.rounding.normal
implicitWidth: NotifsConfig.sizes.width
+ implicitHeight: inner.height
+
+ MouseArea {
+ property int startY
+
+ anchors.fill: parent
+ hoverEnabled: true
+ preventStealing: true
+
+ onEntered: root.modelData.timer.stop()
+ onExited: root.modelData.timer.start()
+
+ drag.target: parent
+ drag.axis: Drag.XAxis
+
+ onPressed: event => startY = event.y
+ onReleased: event => {
+ if (Math.abs(root.x) < NotifsConfig.sizes.width * NotifsConfig.clearThreshold)
+ root.x = 0;
+ else
+ root.modelData.popup = false;
+ }
+ onPositionChanged: event => {
+ if (pressed) {
+ const diffY = event.y - startY;
+ if (Math.abs(diffY) > NotifsConfig.expandThreshold)
+ root.expanded = diffY > 0;
+ }
+ }
+ }
+
+ Behavior on x {
+ NumberAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
+ }
+ }
Item {
+ id: inner
+
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
@@ -160,6 +200,11 @@ StyledRect {
text: root.expanded ? "expand_less" : "expand_more"
font.pointSize: Appearance.font.size.smaller
}
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: root.expanded = !root.expanded
+ }
}
StyledText {