diff options
Diffstat (limited to 'modules/notifications')
| -rw-r--r-- | modules/notifications/Background.qml | 93 | ||||
| -rw-r--r-- | modules/notifications/Notifications.qml | 74 | ||||
| -rw-r--r-- | modules/notifications/Wrapper.qml | 54 |
3 files changed, 65 insertions, 156 deletions
diff --git a/modules/notifications/Background.qml b/modules/notifications/Background.qml index a0ed11e..9e66697 100644 --- a/modules/notifications/Background.qml +++ b/modules/notifications/Background.qml @@ -3,63 +3,54 @@ import "root:/config" import QtQuick import QtQuick.Shapes -Shape { +ShapePath { id: root - required property real wrapperWidth - required property real wrapperHeight + required property Wrapper wrapper readonly property real rounding: BorderConfig.rounding - readonly property bool flatten: wrapperHeight < rounding * 2 - readonly property real roundingY: flatten ? wrapperHeight / 2 : rounding + readonly property bool flatten: wrapper.height < rounding * 2 + readonly property real roundingY: flatten ? wrapper.height / 2 : rounding - preferredRendererType: Shape.CurveRenderer - opacity: Colours.transparency.enabled ? Colours.transparency.base : 1 + strokeWidth: -1 + fillColor: BorderConfig.colour - ShapePath { - strokeWidth: -1 - fillColor: BorderConfig.colour - - startX: root.wrapperWidth - - PathLine {} - PathArc { - relativeX: root.rounding - relativeY: root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapperHeight) - } - PathLine { - relativeX: 0 - y: root.flatten ? root.roundingY : root.wrapperHeight - root.rounding - } - PathArc { - relativeX: root.rounding - relativeY: root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapperHeight) - direction: PathArc.Counterclockwise - } - PathLine { - x: root.wrapperWidth - root.rounding - 1 - relativeY: 0 - } - PathArc { - relativeX: root.rounding - relativeY: root.rounding - radiusX: root.rounding - radiusY: root.rounding - } - PathLine { - relativeX: 1 - relativeY: 0 - } + PathLine { + relativeX: -root.wrapper.width + relativeY: 0 + } + PathArc { + relativeX: root.rounding + relativeY: root.roundingY + radiusX: root.rounding + radiusY: Math.min(root.rounding, root.wrapper.height) + } + PathLine { + relativeX: 0 + relativeY: root.wrapper.height - root.roundingY * 2 + } + PathArc { + relativeX: root.rounding + relativeY: root.roundingY + radiusX: root.rounding + radiusY: Math.min(root.rounding, root.wrapper.height) + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: root.wrapper.height > 0 ? root.wrapper.width - root.rounding * 3 : root.wrapper.width + relativeY: 0 + } + PathArc { + relativeX: root.rounding + relativeY: root.rounding + radiusX: root.rounding + radiusY: root.rounding + } - Behavior on fillColor { - ColorAnimation { - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standard - } + Behavior on fillColor { + ColorAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard } } } diff --git a/modules/notifications/Notifications.qml b/modules/notifications/Notifications.qml deleted file mode 100644 index 52f2a7f..0000000 --- a/modules/notifications/Notifications.qml +++ /dev/null @@ -1,74 +0,0 @@ -import "root:/widgets" -import "root:/services" -import "root:/config" -import Quickshell -import Quickshell.Wayland -import QtQuick - -Variants { - model: Quickshell.screens - - Scope { - id: root - - required property ShellScreen modelData - property bool osdVisible: Notifs.popups.length > 0 - - LazyLoader { - loading: true - - StyledWindow { - id: win - - screen: root.modelData - name: "notifications" - visible: wrapper.shouldBeVisible - exclusionMode: ExclusionMode.Normal - - mask: Region { - item: wrapper - } - - anchors.top: true - anchors.bottom: true - anchors.left: true - anchors.right: true - - width: wrapper.width - height: wrapper.height - - Background { - id: bg - - visible: false - - anchors.top: parent.top - anchors.right: parent.right - - wrapperWidth: wrapper.width - wrapperHeight: Math.min(wrapper.height, content.height) - } - - LayerShadow { - source: bg - } - - Wrapper { - id: wrapper - - anchors.top: parent.top - anchors.right: parent.right - - implicitWidth: content.width + bg.rounding - - osdVisible: root.osdVisible - contentHeight: content.height - - Content { - id: content - } - } - } - } - } -} diff --git a/modules/notifications/Wrapper.qml b/modules/notifications/Wrapper.qml index a98ab4b..e333560 100644 --- a/modules/notifications/Wrapper.qml +++ b/modules/notifications/Wrapper.qml @@ -1,23 +1,23 @@ import "root:/config" +import Quickshell import QtQuick Item { id: root - required property bool osdVisible - required property real contentHeight - property bool shouldBeVisible + required property ShellScreen screen + required property bool visibility visible: height > 0 - height: 0 + implicitHeight: 0 + implicitWidth: content.width + BorderConfig.rounding states: State { name: "visible" - when: root.osdVisible + when: root.visibility PropertyChanges { - root.height: contentHeight - root.shouldBeVisible: true + root.implicitHeight: content.height } } @@ -26,37 +26,29 @@ Item { from: "" to: "visible" - SequentialAnimation { - PropertyAction { - target: root - property: "shouldBeVisible" - } - NumberAnimation { - target: root - property: "height" - duration: Appearance.anim.durations.large - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedDecel - } + NumberAnimation { + target: root + property: "implicitHeight" + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel } }, Transition { from: "visible" to: "" - SequentialAnimation { - NumberAnimation { - target: root - property: "height" - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standard - } - PropertyAction { - target: root - property: "shouldBeVisible" - } + NumberAnimation { + target: root + property: "implicitHeight" + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard } } ] + + Content { + id: content + } } |