summaryrefslogtreecommitdiff
path: root/modules/background
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-18 21:31:36 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-18 21:31:36 +1000
commitc94b7614597727977553500ffc9697c9e062e6dc (patch)
treef78a07a0dbea944fab5102f0cb199ec48596801a /modules/background
parenticons: add gimp sub (diff)
downloadcaelestia-shell-c94b7614597727977553500ffc9697c9e062e6dc.tar.gz
caelestia-shell-c94b7614597727977553500ffc9697c9e062e6dc.tar.bz2
caelestia-shell-c94b7614597727977553500ffc9697c9e062e6dc.zip
wallpaper: add fallback and selector
Add fallback for when no wallpaper and button to set
Diffstat (limited to 'modules/background')
-rw-r--r--modules/background/Wallpaper.qml77
1 files changed, 76 insertions, 1 deletions
diff --git a/modules/background/Wallpaper.qml b/modules/background/Wallpaper.qml
index f4e3243..1f38967 100644
--- a/modules/background/Wallpaper.qml
+++ b/modules/background/Wallpaper.qml
@@ -4,6 +4,7 @@ import "root:/widgets"
import "root:/services"
import "root:/config"
import QtQuick
+import QtQuick.Dialogs
Item {
id: root
@@ -14,12 +15,86 @@ Item {
anchors.fill: parent
onSourceChanged: {
- if (current === one)
+ if (!source)
+ current = null;
+ else if (current === one)
two.update();
else
one.update();
}
+ Loader {
+ anchors.fill: parent
+
+ active: !root.source
+ asynchronous: true
+
+ sourceComponent: StyledRect {
+ color: Colours.palette.m3surfaceContainer
+
+ Row {
+ anchors.centerIn: parent
+ spacing: Appearance.spacing.large
+
+ MaterialIcon {
+ text: "sentiment_stressed"
+ color: Colours.palette.m3onSurfaceVariant
+ font.pointSize: Appearance.font.size.extraLarge * 5
+ font.variableAxes: ({
+ opsz: Appearance.font.size.extraLarge * 5
+ })
+ }
+
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: Appearance.spacing.small
+
+ StyledText {
+ text: qsTr("Wallpaper missing?")
+ color: Colours.palette.m3onSurfaceVariant
+ font.pointSize: Appearance.font.size.extraLarge * 2
+ font.bold: true
+ }
+
+ StyledRect {
+ implicitWidth: selectWallText.implicitWidth + Appearance.padding.large * 2
+ implicitHeight: selectWallText.implicitHeight + Appearance.padding.small * 2
+
+ radius: Appearance.rounding.full
+ color: Colours.palette.m3primary
+
+ FileDialog {
+ id: dialog
+
+ nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`]
+
+ onAccepted: Wallpapers.setWallpaper(selectedFile.toString().replace("file://", ""))
+ }
+
+ StateLayer {
+ radius: parent.radius
+ color: Colours.palette.m3onPrimary
+
+ function onClicked(): void {
+ dialog.open();
+ }
+ }
+
+ StyledText {
+ id: selectWallText
+
+ anchors.centerIn: parent
+
+ text: qsTr("Set it now!")
+ color: Colours.palette.m3onPrimary
+ font.pointSize: Appearance.font.size.large
+ }
+ }
+ }
+ }
+ }
+ }
+
Img {
id: one
}