implement wallpaper switcher widget and refine color generation command
This commit is contained in:
parent
65124d8d42
commit
a3b84debd4
@ -20,9 +20,4 @@ Item {
|
||||
Settings.config.generateScheme = toggle;
|
||||
}
|
||||
}
|
||||
Process {
|
||||
id: wallustRunner
|
||||
property string cmd: "matugen image " + Settings.config.currentWall + " -t scheme-fidelity"
|
||||
command: ["sh", "-c", cmd]
|
||||
}
|
||||
}
|
||||
|
||||
82
modules/widgets/wallswitcher/WallSwitcher.qml
Normal file
82
modules/widgets/wallswitcher/WallSwitcher.qml
Normal file
@ -0,0 +1,82 @@
|
||||
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
|
||||
|
||||
FloatingWindow {
|
||||
id: wallswitcherWindow
|
||||
implicitHeight: 1200
|
||||
implicitWidth: 1800
|
||||
title: "qs-wallswitcher"
|
||||
color: "green"
|
||||
WrapperItem {
|
||||
id: innerWindowWrapper
|
||||
anchors.centerIn: parent
|
||||
anchors.fill: parent
|
||||
margin: 20
|
||||
child: Rectangle {
|
||||
id: innerWindow
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: parent.implicitWidth
|
||||
implicitHeight: parent.implicitHeight
|
||||
GridView {
|
||||
id: gridRoot
|
||||
cellWidth: 140
|
||||
cellHeight: 100
|
||||
topMargin: innerWindowText.implicitHeight + innerWindowText.topPadding
|
||||
anchors.fill: parent
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
leftMargin: 20
|
||||
rightMargin: 20
|
||||
|
||||
FolderListModel {
|
||||
id: folderModel
|
||||
folder: Settings.config.wallDir
|
||||
nameFilters: ["*.png", "*.jpg"]
|
||||
}
|
||||
|
||||
Component {
|
||||
id: fileDelegate
|
||||
Image {
|
||||
required property string filePath
|
||||
source: filePath
|
||||
width: 120
|
||||
height: 80
|
||||
MouseArea {
|
||||
id: wallpaperSetter
|
||||
Process {
|
||||
id: wallustRunner
|
||||
property string cmd: "matugen image " + Settings.config.currentWall + " -t scheme-fidelity"
|
||||
command: ["sh", "-c", cmd]
|
||||
}
|
||||
acceptedButtons: Qt.LeftButton
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
Settings.config.currentWall = parent.filePath;
|
||||
wallustRunner.startDetached();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model: folderModel
|
||||
delegate: fileDelegate
|
||||
}
|
||||
|
||||
radius: 24
|
||||
color: "black"
|
||||
CustomText {
|
||||
id: innerWindowText
|
||||
topPadding: 10
|
||||
text: "Hello, world!"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,20 +5,20 @@ import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: settings
|
||||
id: root
|
||||
property alias config: settingsAdapter
|
||||
property alias currentWall: settingsAdapter.currentWall
|
||||
onConfigChanged: {
|
||||
console.log('config change detected, writing adapter');
|
||||
settingsView.writeAdapter();
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: settingsView
|
||||
|
||||
onAdapterUpdated: writeAdapter()
|
||||
onFileChanged: reload()
|
||||
|
||||
path: "/home/lucy/.config/quickshell/settings/config.json"
|
||||
watchChanges: true
|
||||
watchChanges: false
|
||||
|
||||
adapter: JsonAdapter {
|
||||
id: settingsAdapter
|
||||
@ -28,7 +28,7 @@ Singleton {
|
||||
property var font: "Google Sans"
|
||||
property var fontSize: 14
|
||||
property var rounding: 10
|
||||
property var wallDir: "/home/lucy/.walls"
|
||||
property var wallDir: "file:///home/lucy/.walls/"
|
||||
property bool floating: true
|
||||
property int paddingTop: 10
|
||||
property int paddingSides: 10
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user