2026-01-21 21:58:46 +01:00
|
|
|
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
|
2026-01-21 22:25:30 +01:00
|
|
|
import qs
|
|
|
|
|
import Quickshell.Hyprland
|
2026-01-22 10:30:41 +01:00
|
|
|
import QtQuick.Layouts
|
2026-01-21 21:58:46 +01:00
|
|
|
|
|
|
|
|
FloatingWindow {
|
2026-01-21 22:25:30 +01:00
|
|
|
id: root
|
2026-01-22 10:30:41 +01:00
|
|
|
implicitHeight: 600
|
|
|
|
|
implicitWidth: 900
|
|
|
|
|
title: "qs-wallswitcher"
|
2026-01-21 22:25:30 +01:00
|
|
|
visible: Settings.config.wallSwitcherShown
|
2026-01-22 10:30:41 +01:00
|
|
|
color: Colors.background
|
2026-01-21 22:28:40 +01:00
|
|
|
onClosed: {
|
|
|
|
|
Settings.config.wallSwitcherShown = false;
|
|
|
|
|
}
|
2026-01-21 22:25:30 +01:00
|
|
|
Process {
|
|
|
|
|
id: wallustRunner
|
2026-01-21 22:48:40 +01:00
|
|
|
property string cmd: "matugen image " + Settings.config.currentWall
|
2026-01-21 22:25:30 +01:00
|
|
|
command: ["sh", "-c", cmd]
|
|
|
|
|
}
|
|
|
|
|
GlobalShortcut {
|
|
|
|
|
name: "showWallSwitcher"
|
|
|
|
|
onPressed: {
|
|
|
|
|
Settings.config.wallSwitcherShown = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-22 10:30:41 +01:00
|
|
|
ColumnLayout {
|
|
|
|
|
id: windowLayout
|
2026-01-21 21:58:46 +01:00
|
|
|
anchors.fill: parent
|
2026-01-22 10:30:41 +01:00
|
|
|
|
|
|
|
|
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 {
|
2026-01-21 21:58:46 +01:00
|
|
|
id: innerWindow
|
2026-01-22 10:30:41 +01:00
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
Layout.margins: 20
|
|
|
|
|
radius: 14
|
|
|
|
|
color: Colors.color8
|
2026-01-21 21:58:46 +01:00
|
|
|
GridView {
|
|
|
|
|
id: gridRoot
|
2026-01-22 10:30:41 +01:00
|
|
|
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
|
2026-01-21 21:58:46 +01:00
|
|
|
cellWidth: 140
|
|
|
|
|
cellHeight: 100
|
2026-01-22 10:30:41 +01:00
|
|
|
anchors.fill: innerWindow
|
|
|
|
|
anchors.centerIn: innerWindow
|
|
|
|
|
leftMargin: emptySpace / 2
|
|
|
|
|
anchors.margins: 20
|
|
|
|
|
model: folderModel
|
|
|
|
|
delegate: fileDelegate
|
2026-01-21 21:58:46 +01:00
|
|
|
FolderListModel {
|
|
|
|
|
id: folderModel
|
|
|
|
|
folder: Settings.config.wallDir
|
|
|
|
|
nameFilters: ["*.png", "*.jpg"]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: fileDelegate
|
|
|
|
|
Image {
|
2026-01-21 22:25:30 +01:00
|
|
|
asynchronous: true
|
|
|
|
|
cache: true
|
2026-01-21 21:58:46 +01:00
|
|
|
required property string filePath
|
|
|
|
|
source: filePath
|
|
|
|
|
width: 120
|
|
|
|
|
height: 80
|
2026-01-21 22:25:30 +01:00
|
|
|
sourceSize.width: 120
|
|
|
|
|
sourceSize.height: 80
|
2026-01-21 21:58:46 +01:00
|
|
|
MouseArea {
|
|
|
|
|
id: wallpaperSetter
|
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
|
onClicked: {
|
|
|
|
|
Settings.config.currentWall = parent.filePath;
|
2026-01-21 21:59:50 +01:00
|
|
|
if (Settings.config.generateScheme) {
|
|
|
|
|
wallustRunner.startDetached();
|
|
|
|
|
}
|
2026-01-21 21:58:46 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|