Version 0.1
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Defaults. User config overrides any of these.
|
||||
property string fontFamily: "JetBrainsMono Nerd Font Propo"
|
||||
property int fontSize: 16
|
||||
property string giphyApiKey: ""
|
||||
property int panelWidth: 720
|
||||
property int panelHeight: 520
|
||||
|
||||
property bool loaded: false
|
||||
|
||||
function _apply(obj) {
|
||||
if (typeof obj.fontFamily === "string" && obj.fontFamily.length > 0) fontFamily = obj.fontFamily;
|
||||
if (typeof obj.fontSize === "number" && obj.fontSize > 0) fontSize = obj.fontSize;
|
||||
if (typeof obj.giphyApiKey === "string") giphyApiKey = obj.giphyApiKey;
|
||||
if (typeof obj.panelWidth === "number" && obj.panelWidth > 0) panelWidth = obj.panelWidth;
|
||||
if (typeof obj.panelHeight === "number" && obj.panelHeight > 0) panelHeight = obj.panelHeight;
|
||||
}
|
||||
|
||||
property Process _loader: Process {
|
||||
running: true
|
||||
command: ["sh", "-c", "cat \"${XDG_CONFIG_HOME:-$HOME/.config}/omni-launcher/config.json\" 2>/dev/null"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const text = (this.text || "").trim();
|
||||
if (text.length > 0) {
|
||||
try {
|
||||
root._apply(JSON.parse(text));
|
||||
} catch (e) {
|
||||
console.log("omni-launcher: config.json parse error:", e);
|
||||
}
|
||||
}
|
||||
root.loaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user