53 lines
1.4 KiB
QML
53 lines
1.4 KiB
QML
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
property bool workspaces: true
|
|
property bool tray: true
|
|
property bool windowTitle: true
|
|
property bool clock: true
|
|
property bool notifications: true
|
|
property bool mpris: true
|
|
property bool volume: true
|
|
property bool bluetooth: true
|
|
property bool backlight: true
|
|
property bool network: true
|
|
property bool powerProfile: true
|
|
property bool idleInhibitor: true
|
|
property bool weather: true
|
|
property bool temperature: true
|
|
property bool cpu: true
|
|
property bool memory: true
|
|
property bool disk: true
|
|
property bool battery: true
|
|
property bool wlogout: true
|
|
|
|
property var weatherArgs: ["--nerd"]
|
|
|
|
property FileView _file: FileView {
|
|
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/modules.json"
|
|
watchChanges: true
|
|
onFileChanged: reload()
|
|
onLoaded: root._apply(text())
|
|
}
|
|
|
|
function _apply(raw) {
|
|
let data;
|
|
try {
|
|
data = JSON.parse(raw);
|
|
} catch (e) {
|
|
return;
|
|
}
|
|
for (const k of Object.keys(data)) {
|
|
if (k in root && typeof root[k] === "boolean")
|
|
root[k] = data[k];
|
|
}
|
|
if (Array.isArray(data.weatherArgs))
|
|
root.weatherArgs = data.weatherArgs;
|
|
}
|
|
}
|