nova-shell/modules/Modules.qml
2026-04-12 12:19:30 +02:00

48 lines
1.2 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
QtObject {
id: root
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 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];
}
}
}