pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import QtQuick.Layouts import Quickshell import "../controls" import "../../components" import "../../services" import "../../theme" import "../../core" SettingsPage { id: root property string selected: "" Component.onCompleted: { WallpaperService.refresh(); WallpaperService.scan(); } SettingsSection { SettingRow { title: "Wallpaper picker" description: "Browse large wallpaper cards, search your folders and revisit recent wallpapers. The built-in backend works without Serpantinum." icon: "󰸉" GlassButton { objectName: "openWallpaperPicker" text: "Open picker" accented: true onClicked: ShellState.openWallpaperPicker() } } } SettingsSection { title: "Gallery" description: "Select an image, then apply it to the chosen monitor" padded: true GridView { id: grid objectName: "wallpaperGrid" Layout.fillWidth: true Layout.preferredHeight: 300 clip: true model: WallpaperService.images cellWidth: Math.max(140, width / Math.max(1, Math.floor(width / 170))) cellHeight: 125 ScrollBar.vertical: ScrollBar {} delegate: Rectangle { id: tile required property var modelData readonly property bool chosen: root.selected === modelData.path width: grid.cellWidth - 8 height: 117 radius: Math.max(8, Theme.radius * 0.55) color: tileArea.containsMouse ? Theme.hover : Theme.surfaceVariant border.width: chosen ? 2 : 1 border.color: chosen ? Theme.accent : Theme.border scale: tileArea.containsMouse ? 1 + 0.02 * Theme.intensity : 1 Behavior on scale { NumberAnimation { duration: Theme.duration easing.type: Easing.OutCubic } } Image { anchors { top: parent.top left: parent.left right: parent.right margins: 4 } height: 82 source: tile.modelData.url sourceSize: Qt.size(220, 140) asynchronous: true fillMode: Image.PreserveAspectCrop clip: true } Text { anchors { bottom: parent.bottom left: parent.left right: parent.right margins: 8 } text: (WallpaperService.currentPath === tile.modelData.path ? "✓ " : "") + tile.modelData.name color: Theme.text elide: Text.ElideMiddle font.pixelSize: 12 } MouseArea { id: tileArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: root.selected = tile.modelData.path } } } Text { visible: WallpaperService.images.length === 0 text: WallpaperService.scanning ? "Loading images…" : "Add a folder containing PNG, JPEG, WebP or BMP images." color: Theme.textSecondary wrapMode: Text.Wrap Layout.fillWidth: true } RowLayout { Layout.fillWidth: true Text { text: WallpaperService.error || WallpaperService.notice color: WallpaperService.error ? Theme.urgent : Theme.textSecondary font.pixelSize: 11 wrapMode: Text.Wrap Layout.fillWidth: true } GlassButton { objectName: "wallpaperApply" text: WallpaperService.busy ? "Applying…" : "Apply selected wallpaper" accented: root.selected !== "" enabled: root.selected !== "" && !WallpaperService.busy onClicked: WallpaperService.apply(root.selected) } } } SettingsSection { title: "Wallpaper folders" description: "One absolute path per line" padded: true GlassTextArea { id: folders Layout.fillWidth: true Layout.preferredHeight: 72 text: ConfigService.data.wallpaper.directories.join("\n") wrapMode: TextEdit.NoWrap selectByMouse: true } RowLayout { GlassButton { text: "Save folders" onClicked: { if (ConfigService.setValue("wallpaper.directories", folders.text.split("\n").map(s => s.trim()).filter(Boolean))) WallpaperService.scan(); } } GlassButton { text: "Use Pictures" onClicked: { ConfigService.setValue("wallpaper.directories", [Quickshell.env("HOME") + "/Pictures"]); WallpaperService.scan(); } } GlassButton { text: "Refresh" enabled: !WallpaperService.scanning onClicked: { WallpaperService.refresh(); WallpaperService.scan(); } } } } SettingsSection { title: "Output" description: "Detected: " + WallpaperService.backend + " · Current: " + (WallpaperService.currentPath || "unknown") SettingRow { title: "Apply to monitor" description: "“all” sets every connected display" icon: "󰍹" GlassComboBox { Layout.preferredWidth: 240 model: ["all", "primary"].concat(Quickshell.screens.map(s => s.name)) currentIndex: Math.max(0, model.indexOf(WallpaperService.selectedMonitor)) onActivated: WallpaperService.selectedMonitor = currentText } } PreferenceChoice { label: "Backend" description: "Tool that sets the wallpaper" icon: "󰒓" setting: "wallpaper.backend" choices: ["native", "auto", "serpantinum", "awww", "custom"] } SettingRow { visible: ConfigService.data.wallpaper.backend === "custom" title: "Custom command" description: "JSON argument array; {path} and {monitor} are substituted" setting: "wallpaper.command" GlassTextField { Layout.preferredWidth: 280 text: JSON.stringify(ConfigService.data.wallpaper.command) placeholderText: '["your-tool", "{path}", "{monitor}"]' onEditingFinished: { try { ConfigService.setValue("wallpaper.command", JSON.parse(text)); } catch (error) { WallpaperService.error = "Custom command must be a JSON argument array."; } } } } PreferenceChoice { label: "Palette monitor" description: "Wallpaper used for Matugen palette generation" icon: "󰏘" setting: "wallpaper.paletteMonitor" choices: ["primary"].concat(Quickshell.screens.map(s => s.name)) } SettingNote { visible: WallpaperService.backend === "serpantinum" text: "Serpantinum applies its own wallpaper hooks. glassMxrph generates its palette separately without app hooks." } } }