make config use json instead of shitty qt implementation
This commit is contained in:
parent
4e294cb377
commit
31965a0dba
40 changed files with 272 additions and 745 deletions
|
|
@ -2,33 +2,43 @@ pragma Singleton
|
|||
import QtCore
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
property string font: "Maple Mono"
|
||||
property int fontSize: 12
|
||||
property int iconSize: 14
|
||||
property int barHeight: 30
|
||||
property int rounding: 16
|
||||
property url wallpaper: "file:///home/lucy/.walls/frierensuff.png"
|
||||
property bool floating: false
|
||||
property double opacity: 1.0
|
||||
property string primaryMon: "eDP-1"
|
||||
property string wallDir: "file://" + Quickshell.env("HOME") + "/.walls"
|
||||
property bool showCorners: true
|
||||
property real moduleHeight: barHeight - 8
|
||||
Settings {
|
||||
location: Qt.resolvedUrl("file:///home/lucy/.config/quickshell/settings/settings.ini")
|
||||
property alias font: root.font
|
||||
property alias fontSize: root.fontSize
|
||||
property alias barHeight: root.barHeight
|
||||
property alias rounding: root.rounding
|
||||
property alias wallpaper: root.wallpaper
|
||||
property alias opacity: root.opacity
|
||||
property alias primaryMon: root.primaryMon
|
||||
property alias floating: root.floating
|
||||
property alias wallDir: root.wallDir
|
||||
property alias showCorners: root.showCorners
|
||||
property alias iconSize: root.iconSize
|
||||
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();
|
||||
}
|
||||
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 JsonObject bar: JsonObject {
|
||||
property bool floating: true
|
||||
property int height: 40
|
||||
property real opacity: 1.0
|
||||
}
|
||||
property JsonObject wallpaper: JsonObject {
|
||||
property string wallDir: Quickshell.env("HOME") + "/.walls/"
|
||||
property string wallpaper: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue