From 5978db658c541d4acf4de4a14139232f4a57284c Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 3 May 2025 14:32:53 +1000 Subject: feat: launcher actions --- modules/launcher/AppList.qml | 86 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 7 deletions(-) (limited to 'modules/launcher/AppList.qml') diff --git a/modules/launcher/AppList.qml b/modules/launcher/AppList.qml index 3175402..ab08db7 100644 --- a/modules/launcher/AppList.qml +++ b/modules/launcher/AppList.qml @@ -1,3 +1,5 @@ +pragma ComponentBehavior: Bound + import "root:/widgets" import "root:/services" import "root:/config" @@ -9,18 +11,29 @@ ListView { id: root required property int padding - required property string search + required property TextField search required property Scope launcher + property bool isAction: search.text.startsWith(LauncherConfig.actionPrefix) + + function getModelValues() { + let text = search.text; + if (isAction) + return Actions.fuzzyQuery(text); + if (text.startsWith(LauncherConfig.actionPrefix)) + text = search.text.slice(LauncherConfig.actionPrefix.length); + return Apps.fuzzyQuery(text); + } + model: ScriptModel { - values: Apps.fuzzyQuery(root.search) + values: root.getModelValues() onValuesChanged: root.currentIndex = 0 } clip: true spacing: Appearance.spacing.small orientation: Qt.Vertical - implicitHeight: ((currentItem?.height ?? 1) + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing + implicitHeight: (LauncherConfig.sizes.itemHeight + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing anchors.left: parent.left anchors.right: parent.right @@ -34,9 +47,7 @@ ListView { color: Appearance.alpha(Appearance.colours.m3surfaceContainerHighest, true) } - delegate: AppItem { - launcher: root.launcher - } + delegate: isAction ? actionItem : appItem ScrollBar.vertical: StyledScrollBar { // Move half out @@ -84,8 +95,69 @@ ListView { } } + Component { + id: appItem + + AppItem { + launcher: root.launcher + } + } + + Component { + id: actionItem + + ActionItem { + list: root + } + } + Behavior on implicitHeight { - Anim {} + Anim { + duration: Appearance.anim.durations.large + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel + } + } + + Behavior on isAction { + SequentialAnimation { + ParallelAnimation { + Anim { + target: root + property: "opacity" + from: 1 + to: 0 + duration: Appearance.anim.durations.small + easing.bezierCurve: Appearance.anim.curves.standardAccel + } + Anim { + target: root + property: "scale" + from: 1 + to: 0.9 + duration: Appearance.anim.durations.small + easing.bezierCurve: Appearance.anim.curves.standardAccel + } + } + PropertyAction {} + ParallelAnimation { + Anim { + target: root + property: "opacity" + from: 0 + to: 1 + duration: Appearance.anim.durations.small + easing.bezierCurve: Appearance.anim.curves.standardDecel + } + Anim { + target: root + property: "scale" + from: 0.9 + to: 1 + duration: Appearance.anim.durations.small + easing.bezierCurve: Appearance.anim.curves.standardDecel + } + } + } } component Anim: NumberAnimation { -- cgit v1.2.3-freya