summaryrefslogtreecommitdiff
path: root/modules/launcher/Wrapper.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-12 18:04:44 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-09-12 18:04:44 +1000
commit302a82da2dda3f1b8f86649bd801697f9f3c2209 (patch)
tree1c8763acb83aa01102c9f7587f6a0e02890a6a00 /modules/launcher/Wrapper.qml
parentosd: loader content (diff)
downloadcaelestia-shell-302a82da2dda3f1b8f86649bd801697f9f3c2209.tar.gz
caelestia-shell-302a82da2dda3f1b8f86649bd801697f9f3c2209.tar.bz2
caelestia-shell-302a82da2dda3f1b8f86649bd801697f9f3c2209.zip
launcher: loader content
Diffstat (limited to 'modules/launcher/Wrapper.qml')
-rw-r--r--modules/launcher/Wrapper.qml80
1 files changed, 50 insertions, 30 deletions
diff --git a/modules/launcher/Wrapper.qml b/modules/launcher/Wrapper.qml
index d977b07..299828f 100644
--- a/modules/launcher/Wrapper.qml
+++ b/modules/launcher/Wrapper.qml
@@ -1,3 +1,5 @@
+pragma ComponentBehavior: Bound
+
import qs.components
import qs.config
import Quickshell
@@ -9,48 +11,66 @@ Item {
required property PersistentProperties visibilities
required property var panels
+ readonly property bool shouldBeActive: visibilities.launcher && Config.launcher.enabled
+ property int contentHeight
+
visible: height > 0
implicitHeight: 0
implicitWidth: content.implicitWidth
- states: State {
- name: "visible"
- when: root.visibilities.launcher && Config.launcher.enabled
-
- PropertyChanges {
- root.implicitHeight: content.implicitHeight
+ onShouldBeActiveChanged: {
+ if (shouldBeActive) {
+ hideAnim.stop();
+ showAnim.start();
+ } else {
+ showAnim.stop();
+ hideAnim.start();
}
}
- transitions: [
- Transition {
- from: ""
- to: "visible"
+ SequentialAnimation {
+ id: showAnim
+
+ Anim {
+ target: root
+ property: "implicitHeight"
+ to: root.contentHeight
+ duration: Appearance.anim.durations.expressiveDefaultSpatial
+ easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
+ }
+ ScriptAction {
+ script: root.implicitHeight = Qt.binding(() => content.implicitHeight)
+ }
+ }
- Anim {
- target: root
- property: "implicitHeight"
- duration: Appearance.anim.durations.expressiveDefaultSpatial
- easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
- }
- },
- Transition {
- from: "visible"
- to: ""
+ SequentialAnimation {
+ id: hideAnim
- Anim {
- target: root
- property: "implicitHeight"
- easing.bezierCurve: Appearance.anim.curves.emphasized
- }
+ ScriptAction {
+ script: root.implicitHeight = root.implicitHeight
}
- ]
+ Anim {
+ target: root
+ property: "implicitHeight"
+ to: 0
+ easing.bezierCurve: Appearance.anim.curves.emphasized
+ }
+ }
- Content {
+ Loader {
id: content
- wrapper: root
- visibilities: root.visibilities
- panels: root.panels
+ anchors.top: parent.top
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Component.onCompleted: {
+ root.contentHeight = implicitHeight;
+ active = Qt.binding(() => root.shouldBeActive || root.visible);
+ }
+
+ sourceComponent: Content {
+ visibilities: root.visibilities
+ panels: root.panels
+ }
}
}