108 lines
2.5 KiB
QML
108 lines
2.5 KiB
QML
pragma Singleton
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
QtObject {
|
|
id: root
|
|
|
|
property var workspaces: ({
|
|
enable: true
|
|
})
|
|
property var tray: ({
|
|
enable: true
|
|
})
|
|
property var windowTitle: ({
|
|
enable: true
|
|
})
|
|
property var clock: ({
|
|
enable: true
|
|
})
|
|
property var notifications: ({
|
|
enable: true
|
|
})
|
|
property var mpris: ({
|
|
enable: true
|
|
})
|
|
property var volume: ({
|
|
enable: true
|
|
})
|
|
property var bluetooth: ({
|
|
enable: true,
|
|
interval: 5000
|
|
})
|
|
property var backlight: ({
|
|
enable: true,
|
|
step: 5
|
|
})
|
|
property var network: ({
|
|
enable: true,
|
|
interval: 5000
|
|
})
|
|
property var powerProfile: ({
|
|
enable: true,
|
|
interval: 5000
|
|
})
|
|
property var idleInhibitor: ({
|
|
enable: true
|
|
})
|
|
property var weather: ({
|
|
enable: true,
|
|
args: ["--nerd"],
|
|
interval: 3600000
|
|
})
|
|
property var temperature: ({
|
|
enable: true,
|
|
interval: 2000,
|
|
warm: 60,
|
|
hot: 80
|
|
})
|
|
property var cpu: ({
|
|
enable: true,
|
|
interval: 1000
|
|
})
|
|
property var memory: ({
|
|
enable: true,
|
|
interval: 2000
|
|
})
|
|
property var disk: ({
|
|
enable: true,
|
|
interval: 30000
|
|
})
|
|
property var battery: ({
|
|
enable: true,
|
|
warning: 25,
|
|
critical: 15
|
|
})
|
|
property var power: ({
|
|
enable: 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))
|
|
continue;
|
|
const v = data[k];
|
|
if (typeof v === "object" && v !== null)
|
|
root[k] = Object.assign({}, root[k], v);
|
|
else if (typeof v === "boolean")
|
|
root[k] = Object.assign({}, root[k], {
|
|
enable: v
|
|
});
|
|
}
|
|
}
|
|
}
|