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/WallpaperItem.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/WallpaperItem.qml')
| -rw-r--r-- | modules/launcher/WallpaperItem.qml | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/modules/launcher/WallpaperItem.qml b/modules/launcher/WallpaperItem.qml new file mode 100644 index 0000000..bbd611c --- /dev/null +++ b/modules/launcher/WallpaperItem.qml @@ -0,0 +1,91 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell +import QtQuick +import QtQuick.Effects + +StyledRect { + id: root + + required property Wallpapers.Wallpaper modelData + + scale: PathView.isCurrentItem ? 1 : PathView.onPath ? 0.8 : 0 + opacity: PathView.onPath ? 1 : 0 + z: PathView.isCurrentItem ? 1 : 0 + + implicitWidth: image.width + Appearance.padding.larger * 2 + implicitHeight: image.height + label.height + Appearance.spacing.small / 2 + Appearance.padding.normal * 2 + + StateLayer { + radius: Appearance.rounding.normal + + function onClicked(): void { + console.log("clicked"); + } + } + + Image { + id: image + + anchors.horizontalCenter: parent.horizontalCenter + y: Appearance.padding.normal + + visible: false + source: `file://${root.modelData.path}` + asynchronous: true + fillMode: Image.PreserveAspectCrop + smooth: !root.PathView.view.moving + + width: LauncherConfig.sizes.wallpaperWidth + height: width / 16 * 9 + sourceSize.width: width + sourceSize.height: height + } + + Rectangle { + id: mask + + layer.enabled: true + visible: false + anchors.fill: image + width: image.width + height: image.height + radius: Appearance.rounding.normal + } + + MultiEffect { + anchors.fill: image + source: image + maskEnabled: true + maskSource: mask + } + + StyledText { + id: label + + anchors.top: image.bottom + anchors.topMargin: Appearance.spacing.small / 2 + anchors.horizontalCenter: parent.horizontalCenter + + renderType: Text.QtRendering + text: root.modelData.name + font.pointSize: Appearance.font.size.small + } + + Behavior on scale { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + + Behavior on opacity { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } +} |