diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-03 23:56:37 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-03 23:56:37 +1000 |
| commit | 00d3c1a472888817d7649391d4a8485c5fc6f6f5 (patch) | |
| tree | 45b351c62f61ede55acfc209dde686f1c161a942 /modules/launcher/ContentList.qml | |
| parent | feat: use multieffect instead of qt5compat (diff) | |
| download | caelestia-shell-00d3c1a472888817d7649391d4a8485c5fc6f6f5.tar.gz caelestia-shell-00d3c1a472888817d7649391d4a8485c5fc6f6f5.tar.bz2 caelestia-shell-00d3c1a472888817d7649391d4a8485c5fc6f6f5.zip | |
feat: launcher wallpaper selector
Diffstat (limited to 'modules/launcher/ContentList.qml')
| -rw-r--r-- | modules/launcher/ContentList.qml | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/modules/launcher/ContentList.qml b/modules/launcher/ContentList.qml new file mode 100644 index 0000000..74c229a --- /dev/null +++ b/modules/launcher/ContentList.qml @@ -0,0 +1,193 @@ +pragma ComponentBehavior: Bound + +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell +import QtQuick +import QtQuick.Controls + +Item { + id: root + + required property Scope launcher + required property TextField search + required property int padding + required property int spacing + required property int rounding + + property bool showWallpapers: search.text.startsWith(`${LauncherConfig.actionPrefix}wallpaper `) + property var currentList: (showWallpapers ? wallpaperList : appList).item + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: root.padding + + clip: true + state: showWallpapers ? "wallpapers" : "apps" + + states: [ + State { + name: "apps" + + PropertyChanges { + root.implicitWidth: LauncherConfig.sizes.itemWidth + root.implicitHeight: Math.max(empty.height, appList.height) + appList.active: true + } + + AnchorChanges { + anchors.left: root.parent.left + anchors.right: root.parent.right + } + }, + State { + name: "wallpapers" + + PropertyChanges { + root.implicitWidth: Math.max(LauncherConfig.sizes.itemWidth, wallpaperList.width) + root.implicitHeight: LauncherConfig.sizes.wallpaperHeight + wallpaperList.active: true + } + } + ] + + transitions: Transition { + from: "*" + to: "*" + + SequentialAnimation { + NumberAnimation { + target: root + property: "opacity" + from: 1 + to: 0 + duration: Appearance.anim.durations.small + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + PropertyAction { + targets: [appList, wallpaperList] + properties: "active" + } + ParallelAnimation { + NumberAnimation { + target: root + properties: "implicitWidth,implicitHeight" + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasized + } + NumberAnimation { + target: root + property: "opacity" + from: 0 + to: 1 + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + } + } + + Loader { + id: appList + + active: false + asynchronous: true + + anchors.left: parent.left + anchors.right: parent.right + + sourceComponent: AppList { + padding: root.padding + search: root.search + launcher: root.launcher + } + } + + Loader { + id: wallpaperList + + active: false + asynchronous: true + + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + + sourceComponent: WallpaperList { + search: root.search + launcher: root.launcher + } + } + + Item { + id: empty + + opacity: root.currentList.count === 0 ? 1 : 0 + scale: root.currentList.count === 0 ? 1 : 0.5 + + implicitWidth: icon.width + text.width + Appearance.spacing.small + implicitHeight: icon.height + + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + MaterialIcon { + id: icon + + text: "manage_search" + color: Appearance.colours.m3outline + font.pointSize: Appearance.font.size.extraLarge + + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + id: text + + anchors.left: icon.right + anchors.leftMargin: Appearance.spacing.small + anchors.verticalCenter: parent.verticalCenter + + text: qsTr("No results") + color: Appearance.colours.m3outline + font.pointSize: Appearance.font.size.larger + font.weight: 500 + } + + Behavior on opacity { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + + Behavior on scale { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + } + + Behavior on implicitWidth { + NumberAnimation { + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel + } + } + + Behavior on implicitHeight { + NumberAnimation { + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel + } + } +} |