diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-13 16:30:53 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-13 16:30:53 +1000 |
| commit | ad7c6ea98e4588172398669bb8b7939999c7f121 (patch) | |
| tree | 29cf2fb3e7ccd3884b83f97b7f457be1311ebed0 /modules/osd | |
| parent | notifs: better sliding (diff) | |
| download | caelestia-shell-ad7c6ea98e4588172398669bb8b7939999c7f121.tar.gz caelestia-shell-ad7c6ea98e4588172398669bb8b7939999c7f121.tar.bz2 caelestia-shell-ad7c6ea98e4588172398669bb8b7939999c7f121.zip | |
refactor: move to single window
Diffstat (limited to 'modules/osd')
| -rw-r--r-- | modules/osd/Background.qml | 105 | ||||
| -rw-r--r-- | modules/osd/Wrapper.qml | 56 |
2 files changed, 74 insertions, 87 deletions
diff --git a/modules/osd/Background.qml b/modules/osd/Background.qml index 4b4b92e..75940d3 100644 --- a/modules/osd/Background.qml +++ b/modules/osd/Background.qml @@ -3,68 +3,61 @@ 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: wrapperWidth < rounding * 2 - readonly property real roundingX: flatten ? wrapperWidth / 2 : rounding + readonly property bool flatten: wrapper.width < rounding * 2 + readonly property real roundingX: flatten ? wrapper.width / 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 - 1 - - PathArc { - relativeX: -root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - } - PathLine { - x: root.roundingX - relativeY: 0 - } - PathArc { - relativeX: -root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - direction: PathArc.Counterclockwise - } - PathLine { - y: root.wrapperHeight - root.rounding * 2 - } - PathArc { - relativeX: root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - direction: PathArc.Counterclockwise - } - PathLine { - x: (root.flatten ? root.roundingX : root.wrapperWidth - root.rounding) - 1 - relativeY: 0 - } - PathArc { - relativeX: root.roundingX - relativeY: root.rounding - radiusX: Math.min(root.rounding, root.wrapperWidth) - radiusY: root.rounding - } + PathArc { + relativeX: -root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + } + PathLine { + relativeX: -(root.wrapper.width - root.roundingX * 2) + relativeY: 0 + } + PathArc { + relativeX: -root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: 0 + relativeY: root.wrapper.height - root.rounding * 4 + } + PathArc { + relativeX: root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + radiusY: root.rounding + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: root.wrapper.width - root.roundingX * 2 + relativeY: 0 + } + PathArc { + relativeX: root.roundingX + relativeY: root.rounding + radiusX: Math.min(root.rounding, root.wrapper.width) + 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/osd/Wrapper.qml b/modules/osd/Wrapper.qml index 6c21c1a..e56fa2b 100644 --- a/modules/osd/Wrapper.qml +++ b/modules/osd/Wrapper.qml @@ -1,23 +1,23 @@ +import "root:/services" import "root:/config" +import Quickshell import QtQuick Item { id: root - required property bool osdVisible - required property real contentWidth - property bool shouldBeVisible + required property ShellScreen screen visible: width > 0 - width: 0 + implicitWidth: 0 + implicitHeight: content.height + BorderConfig.rounding * 2 states: State { name: "visible" - when: root.osdVisible + when: Drawers.visibilities[root.screen].osd PropertyChanges { - root.width: contentWidth - root.shouldBeVisible: true + root.implicitWidth: content.width } } @@ -26,37 +26,31 @@ Item { from: "" to: "visible" - SequentialAnimation { - PropertyAction { - target: root - property: "shouldBeVisible" - } - NumberAnimation { - target: root - property: "width" - duration: Appearance.anim.durations.large - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedDecel - } + NumberAnimation { + target: root + property: "implicitWidth" + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel } }, Transition { from: "visible" to: "" - SequentialAnimation { - NumberAnimation { - target: root - property: "width" - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedAccel - } - PropertyAction { - target: root - property: "shouldBeVisible" - } + NumberAnimation { + target: root + property: "implicitWidth" + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedAccel } } ] + + Content { + id: content + + monitor: Brightness.getMonitorForScreen(root.screen) + } } |