pragma ComponentBehavior: Bound import Quickshell import qs.settings import QtQuick import Quickshell.Widgets import qs.reusables import Qt.labs.folderlistmodel 2.10 import Quickshell.Io import qs import Quickshell.Hyprland import QtQuick.Layouts FloatingWindow { id: root implicitHeight: 600 implicitWidth: 900 title: "qs-wallswitcher" visible: Settings.config.wallSwitcherShown color: Colors.background onClosed: { Settings.config.wallSwitcherShown = false; } Process { id: wallustRunner property string cmd: "matugen image " + Settings.config.currentWall command: ["sh", "-c", cmd] } GlobalShortcut { name: "showWallSwitcher" onPressed: { Settings.config.wallSwitcherShown = true; } } ColumnLayout { id: windowLayout anchors.fill: parent Rectangle { id: textWrapper Layout.fillWidth: true Layout.margins: 20 Layout.alignment: Qt.AlignCenter radius: 14 implicitHeight: 30 color: Colors.color6 CustomText { id: titleText anchors.centerIn: textWrapper text: "Wallpapers in " + Settings.config.wallDir } } Rectangle { id: innerWindow Layout.fillWidth: true Layout.fillHeight: true Layout.margins: 20 radius: 14 color: Colors.color8 GridView { id: gridRoot property var columns: Math.floor(gridRoot.width / cellWidth) property var usedWidth: columns * cellWidth property var emptySpace: width - usedWidth property var rows: Math.floor(gridRoot.height / cellHeight) property var usedHeight: rows * cellHeight property var emptyHeight: height - usedHeight clip: true boundsBehavior: Flickable.StopAtBounds snapMode: GridView.SnapToRow cellWidth: 140 cellHeight: 100 anchors.fill: innerWindow anchors.centerIn: innerWindow leftMargin: emptySpace / 2 rightMargin: emptySpace / 2 anchors.margins: 20 model: folderModel delegate: fileDelegate FolderListModel { id: folderModel folder: Settings.config.wallDir nameFilters: ["*.png", "*.jpg"] } Component { id: fileDelegate Image { asynchronous: true cache: true required property string filePath source: filePath width: 120 height: 80 sourceSize.width: 120 sourceSize.height: 80 MouseArea { id: wallpaperSetter acceptedButtons: Qt.LeftButton anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { Settings.config.currentWall = parent.filePath; if (Settings.config.generateScheme) { wallustRunner.startDetached(); } } } } } } } } }