diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-12 18:04:44 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-12 18:04:44 +1000 |
| commit | 302a82da2dda3f1b8f86649bd801697f9f3c2209 (patch) | |
| tree | 1c8763acb83aa01102c9f7587f6a0e02890a6a00 /modules/launcher | |
| parent | osd: loader content (diff) | |
| download | caelestia-shell-302a82da2dda3f1b8f86649bd801697f9f3c2209.tar.gz caelestia-shell-302a82da2dda3f1b8f86649bd801697f9f3c2209.tar.bz2 caelestia-shell-302a82da2dda3f1b8f86649bd801697f9f3c2209.zip | |
launcher: loader content
Diffstat (limited to 'modules/launcher')
| -rw-r--r-- | modules/launcher/Content.qml | 20 | ||||
| -rw-r--r-- | modules/launcher/ContentList.qml | 6 | ||||
| -rw-r--r-- | modules/launcher/WallpaperList.qml | 4 | ||||
| -rw-r--r-- | modules/launcher/Wrapper.qml | 80 |
4 files changed, 60 insertions, 50 deletions
diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index 7158cdd..f4e1b45 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -11,7 +11,6 @@ import QtQuick Item { id: root - required property var wrapper required property PersistentProperties visibilities required property var panels @@ -21,9 +20,6 @@ Item { implicitWidth: listWrapper.width + padding * 2 implicitHeight: searchWrapper.height + listWrapper.height + padding * 2 - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - Item { id: listWrapper @@ -37,7 +33,7 @@ Item { ContentList { id: list - wrapper: root.wrapper + content: root visibilities: root.visibilities panels: root.panels search: search @@ -129,23 +125,19 @@ Item { } } + Component.onCompleted: forceActiveFocus() + Connections { target: root.visibilities function onLauncherChanged(): void { - if (root.visibilities.launcher) - search.focus = true; - else { + if (!root.visibilities.launcher) search.text = ""; - const current = list.currentList; - if (current) - current.currentIndex = 0; - } } function onSessionChanged(): void { - if (root.visibilities.launcher && !root.visibilities.session) - search.focus = true; + if (!root.visibilities.session) + search.forceActiveFocus(); } } } diff --git a/modules/launcher/ContentList.qml b/modules/launcher/ContentList.qml index 41f6a6a..123acdc 100644 --- a/modules/launcher/ContentList.qml +++ b/modules/launcher/ContentList.qml @@ -11,7 +11,7 @@ import QtQuick.Controls Item { id: root - required property var wrapper + required property var content required property PersistentProperties visibilities required property var panels required property TextField search @@ -77,7 +77,6 @@ Item { id: appList active: false - asynchronous: true anchors.left: parent.left anchors.right: parent.right @@ -92,7 +91,6 @@ Item { id: wallpaperList active: false - asynchronous: true anchors.top: parent.top anchors.bottom: parent.bottom @@ -102,7 +100,7 @@ Item { search: root.search visibilities: root.visibilities panels: root.panels - wrapper: root.wrapper + content: root.content } } diff --git a/modules/launcher/WallpaperList.qml b/modules/launcher/WallpaperList.qml index e66ae5c..874111d 100644 --- a/modules/launcher/WallpaperList.qml +++ b/modules/launcher/WallpaperList.qml @@ -13,7 +13,7 @@ PathView { required property TextField search required property PersistentProperties visibilities required property var panels - required property var wrapper + required property var content readonly property int itemWidth: Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2 @@ -24,7 +24,7 @@ PathView { // Screen width - 4x outer rounding - 2x max side thickness (cause centered) let outerMargins = Math.max(Config.border.thickness, panels.bar.implicitWidth); - if (panels.popouts.hasCurrent && panels.popouts.currentCenter + panels.popouts.nonAnimHeight / 2 > screen.height - wrapper.implicitHeight - Config.border.thickness * 2) + if (panels.popouts.hasCurrent && panels.popouts.currentCenter + panels.popouts.nonAnimHeight / 2 > screen.height - content.implicitHeight - Config.border.thickness * 2) outerMargins = panels.bar.implicitWidth + panels.popouts.nonAnimWidth; const maxWidth = screen.width - Config.border.rounding * 4 - outerMargins * 2; 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 + } } } |