diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-02 13:57:16 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-02 13:57:16 +1000 |
| commit | fc87280dcfed7e0268f6b9c9dc840f83cc1c2a9c (patch) | |
| tree | a7a15206e580c4342fa5c7347df669e01fe2b270 /modules/launcher | |
| parent | bar: fix workspaces switching (diff) | |
| download | caelestia-shell-fc87280dcfed7e0268f6b9c9dc840f83cc1c2a9c.tar.gz caelestia-shell-fc87280dcfed7e0268f6b9c9dc840f83cc1c2a9c.tar.bz2 caelestia-shell-fc87280dcfed7e0268f6b9c9dc840f83cc1c2a9c.zip | |
refactor: separate launcher into multiple files
Diffstat (limited to 'modules/launcher')
| -rw-r--r-- | modules/launcher/Background.qml | 64 | ||||
| -rw-r--r-- | modules/launcher/Launcher.qml | 118 | ||||
| -rw-r--r-- | modules/launcher/Wrapper.qml | 66 |
3 files changed, 134 insertions, 114 deletions
diff --git a/modules/launcher/Background.qml b/modules/launcher/Background.qml new file mode 100644 index 0000000..429f12e --- /dev/null +++ b/modules/launcher/Background.qml @@ -0,0 +1,64 @@ +import "root:/config" +import QtQuick +import QtQuick.Shapes + +Shape { + id: root + + required property real realWrapperHeight + readonly property int rounding: Appearance.rounding.large + readonly property int roundingY: Math.min(rounding, realWrapperHeight / 2) + readonly property real wrapperHeight: realWrapperHeight - 1 // Pixel issues :sob: + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + preferredRendererType: Shape.CurveRenderer + opacity: Appearance.transparency.enabled ? Appearance.transparency.base : 1 + + ShapePath { + strokeWidth: -1 + fillColor: Appearance.colours.m3surface + + startY: root.wrapperHeight + + PathArc { + relativeX: root.rounding + relativeY: -root.roundingY + radiusX: root.rounding + radiusY: root.roundingY + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: 0 + y: root.roundingY + } + PathArc { + relativeX: root.rounding + relativeY: -root.roundingY + radiusX: root.rounding + radiusY: root.roundingY + } + PathLine { + x: wrapper.width - root.rounding * 2 + } + PathArc { + relativeX: root.rounding + relativeY: root.roundingY + radiusX: root.rounding + radiusY: root.roundingY + } + PathLine { + relativeX: 0 + y: root.wrapperHeight - root.roundingY + } + PathArc { + relativeX: root.rounding + relativeY: root.roundingY + radiusX: root.rounding + radiusY: root.roundingY + direction: PathArc.Counterclockwise + } + } +} diff --git a/modules/launcher/Launcher.qml b/modules/launcher/Launcher.qml index 8313721..245fd47 100644 --- a/modules/launcher/Launcher.qml +++ b/modules/launcher/Launcher.qml @@ -26,126 +26,16 @@ Scope { anchors.bottom: true - Shape { + Background { id: bg - readonly property int rounding: Appearance.rounding.large - readonly property int roundingY: Math.min(rounding, wrapper.height / 2) - readonly property real wrapperHeight: wrapper.height - 1 // Pixel issues :sob: - - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - - preferredRendererType: Shape.CurveRenderer - opacity: Appearance.transparency.enabled ? Appearance.transparency.base : 1 - - ShapePath { - strokeWidth: -1 - fillColor: Appearance.colours.m3surface - - startY: bg.wrapperHeight - - PathArc { - relativeX: bg.rounding - relativeY: -bg.roundingY - radiusX: bg.rounding - radiusY: bg.roundingY - direction: PathArc.Counterclockwise - } - PathLine { - relativeX: 0 - y: bg.roundingY - } - PathArc { - relativeX: bg.rounding - relativeY: -bg.roundingY - radiusX: bg.rounding - radiusY: bg.roundingY - } - PathLine { - x: wrapper.width - bg.rounding * 2 - } - PathArc { - relativeX: bg.rounding - relativeY: bg.roundingY - radiusX: bg.rounding - radiusY: bg.roundingY - } - PathLine { - relativeX: 0 - y: bg.wrapperHeight - bg.roundingY - } - PathArc { - relativeX: bg.rounding - relativeY: bg.roundingY - radiusX: bg.rounding - radiusY: bg.roundingY - direction: PathArc.Counterclockwise - } - } + realWrapperHeight: wrapper.height } - Item { + Wrapper { id: wrapper - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - - height: 0 - visible: false - - clip: true - - states: State { - name: "visible" - when: root.launcherVisible - - PropertyChanges { - wrapper.height: content.height - wrapper.visible: true - } - } - - transitions: [ - Transition { - from: "" - to: "visible" - - SequentialAnimation { - PropertyAction { - target: wrapper - property: "visible" - } - NumberAnimation { - target: wrapper - property: "height" - duration: Appearance.anim.durations.large - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedDecel - } - } - }, - Transition { - from: "visible" - to: "" - - SequentialAnimation { - NumberAnimation { - target: wrapper - property: "height" - duration: Appearance.anim.durations.extraLarge - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedDecel - } - PropertyAction { - target: wrapper - property: "visible" - } - } - } - ] + launcherVisible: root.launcherVisible PaddedRect { id: content diff --git a/modules/launcher/Wrapper.qml b/modules/launcher/Wrapper.qml new file mode 100644 index 0000000..17e7b3a --- /dev/null +++ b/modules/launcher/Wrapper.qml @@ -0,0 +1,66 @@ +import "root:/config" +import QtQuick + +Item { + id: root + + required property bool launcherVisible + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + height: 0 + visible: false + + clip: true + + states: State { + name: "visible" + when: root.launcherVisible + + PropertyChanges { + root.height: content.height + root.visible: true + } + } + + transitions: [ + Transition { + from: "" + to: "visible" + + SequentialAnimation { + PropertyAction { + target: root + property: "visible" + } + NumberAnimation { + target: root + property: "height" + 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.extraLarge + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel + } + PropertyAction { + target: root + property: "visible" + } + } + } + ] +} |