diff --git a/modules/nexus/pages/wallandstyle/WallpaperSelect.qml b/modules/nexus/pages/wallandstyle/WallpaperSelect.qml index 6eaf5831..fb98333d 100644 --- a/modules/nexus/pages/wallandstyle/WallpaperSelect.qml +++ b/modules/nexus/pages/wallandstyle/WallpaperSelect.qml @@ -2,9 +2,12 @@ pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts +import Caelestia.Components import Caelestia.Config import Caelestia.Models import qs.components +import qs.components.controls +import qs.components.filedialog import qs.services import qs.utils import qs.modules.nexus.common @@ -21,6 +24,44 @@ PageBase { width: root.cappedWidth spacing: Tokens.spacing.small + ButtonRow { + Layout.bottomMargin: Tokens.spacing.medium + Layout.alignment: Qt.AlignHCenter + spacing: Tokens.spacing.small + + IconTextButton { + icon: "photo_library" + text: qsTr("Browse") + font: Tokens.font.body.large + isRound: true + shapeMorph: true + horizontalPadding: Tokens.padding.extraLarge + verticalPadding: Tokens.padding.medium + onClicked: browseDialog.open() + + FileDialog { + id: browseDialog + + title: qsTr("Select an image") + filterLabel: qsTr("Image files") + filters: Images.validImageExtensions + onAccepted: path => Wallpapers.setWallpaper(path) + } + } + + IconTextButton { + icon: "shuffle" + text: qsTr("Random") + font: Tokens.font.body.large + isRound: true + shapeMorph: true + horizontalPadding: Tokens.padding.extraLarge + verticalPadding: Tokens.padding.medium + type: IconTextButton.Tonal + onClicked: Wallpapers.setRandom() + } + } + WallItem { imgHeight: Math.round(width * 0.3) radius: Tokens.rounding.extraLarge diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml index 49d8653e..a56ff348 100644 --- a/services/Wallpapers.qml +++ b/services/Wallpapers.qml @@ -27,6 +27,10 @@ Searcher { return category; } + function setRandom(): void { + Quickshell.execDetached(["caelestia", "wallpaper", "-r", ...smartArg]); + } + function setWallpaper(path: string): void { actualCurrent = path; Quickshell.execDetached(["caelestia", "wallpaper", "-f", path, ...smartArg]);