82 lines
2.2 KiB
QML
82 lines
2.2 KiB
QML
|
|
pragma ComponentBehavior: Bound
|
||
|
|
import Quickshell
|
||
|
|
import Quickshell.Hyprland
|
||
|
|
import Quickshell.Io
|
||
|
|
import QtQuick
|
||
|
|
import Qt.labs.folderlistmodel 2.10
|
||
|
|
import qs
|
||
|
|
import qs.settings
|
||
|
|
|
||
|
|
FloatingWindow {
|
||
|
|
id: root
|
||
|
|
GlobalShortcut {
|
||
|
|
id: wallswitcherToggle
|
||
|
|
name: "showWallSwitcher"
|
||
|
|
onPressed: {
|
||
|
|
Settings.config.wallswitchershown = true;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
Process {
|
||
|
|
id: matugenRunner
|
||
|
|
property string matugen: "matugen image " + Settings.config.currentWall + " --source-color-index=0"
|
||
|
|
running: false
|
||
|
|
command: [ "sh", "-c", matugen ]
|
||
|
|
}
|
||
|
|
implicitWidth: 700
|
||
|
|
title: "qs-wallpicker"
|
||
|
|
implicitHeight: 600
|
||
|
|
color: Colors.base00
|
||
|
|
visible: Settings.config.wallswitchershown
|
||
|
|
onClosed: Settings.config.wallswitchershown = false
|
||
|
|
|
||
|
|
Rectangle {
|
||
|
|
id: container
|
||
|
|
radius: Settings.config.rounding
|
||
|
|
anchors {
|
||
|
|
fill: parent
|
||
|
|
margins: 8
|
||
|
|
}
|
||
|
|
color: Colors.base01
|
||
|
|
FolderListModel {
|
||
|
|
id: wpModel
|
||
|
|
folder: "file:///home/lucy/.walls/"
|
||
|
|
nameFilters: ["*.png"]
|
||
|
|
}
|
||
|
|
Component {
|
||
|
|
id: wallDelegate
|
||
|
|
Rectangle {
|
||
|
|
id: wpPreview
|
||
|
|
required property var filePath
|
||
|
|
implicitWidth: 80
|
||
|
|
implicitHeight: 60
|
||
|
|
color: "transparent"
|
||
|
|
Image {
|
||
|
|
asynchronous: true
|
||
|
|
anchors.fill: parent
|
||
|
|
source: wpPreview.filePath ? wpPreview.filePath : null
|
||
|
|
}
|
||
|
|
MouseArea {
|
||
|
|
id: updater
|
||
|
|
acceptedButtons: Qt.LeftButton
|
||
|
|
cursorShape: Qt.PointingHandCursor
|
||
|
|
anchors.fill: parent
|
||
|
|
onClicked: {
|
||
|
|
Settings.config.currentWall = wpPreview.filePath;
|
||
|
|
matugenRunner.running = true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
GridView {
|
||
|
|
id: wallLayout
|
||
|
|
anchors.centerIn: parent
|
||
|
|
anchors.margins: 20
|
||
|
|
anchors.leftMargin: 40
|
||
|
|
anchors.fill: parent
|
||
|
|
clip: true
|
||
|
|
model: wpModel
|
||
|
|
delegate: wallDelegate
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|