quickshell/settings/Config.qml
2026-09-11 01:46:02 +02:00

48 lines
1.4 KiB
QML

pragma Singleton
import QtCore
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
property alias cfg: cfg
function save() {
if (cfgView.loaded)
cfgView.writeAdapter();
}
FileView {
id: cfgView
path: Qt.resolvedUrl(Quickshell.shellDir + "/settings/settings.json")
watchChanges: true
onFileChanged: {
this.reload();
}
onAdapterUpdated: {
writeAdapter();
}
onLoadFailed: error => {
if (error === FileViewError.FileNotFound)
writeAdapter();
}
adapter: JsonAdapter {
id: cfg
property JsonObject appearance: JsonObject {
property string font: "Iosevka"
property int fontSize: 14
property int iconSize: 16
property int rounding: 16
property string currentTheme: "base16-catppuccin-mocha.json"
}
property JsonObject bar: JsonObject {
property bool floating: false
property int height: 40
property real opacity: 1.0
}
property JsonObject wallpaper: JsonObject {
property string wallDir: Quickshell.env("HOME") + "/.walls/"
property string wallpaper: ""
}
}
}
}