diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-03 14:32:53 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-03 14:32:53 +1000 |
| commit | 5978db658c541d4acf4de4a14139232f4a57284c (patch) | |
| tree | 754eeff62e09569ead024f89cc638a002a12c923 /modules/launcher/AppList.qml | |
| parent | launcher: fix scrollbar (diff) | |
| download | caelestia-shell-5978db658c541d4acf4de4a14139232f4a57284c.tar.gz caelestia-shell-5978db658c541d4acf4de4a14139232f4a57284c.tar.bz2 caelestia-shell-5978db658c541d4acf4de4a14139232f4a57284c.zip | |
feat: launcher actions
Diffstat (limited to 'modules/launcher/AppList.qml')
| -rw-r--r-- | modules/launcher/AppList.qml | 86 |
1 files changed, 79 insertions, 7 deletions
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 { |