diff options
Diffstat (limited to 'appearance')
| -rw-r--r-- | appearance/Hypridle.qml | 6 | ||||
| -rw-r--r-- | appearance/Hyprsunset.qml | 11 | ||||
| -rw-r--r-- | appearance/Icons.qml | 12 | ||||
| -rw-r--r-- | appearance/IdleTab.qml | 9 |
4 files changed, 31 insertions, 7 deletions
diff --git a/appearance/Hypridle.qml b/appearance/Hypridle.qml index e265b88..1696f5f 100644 --- a/appearance/Hypridle.qml +++ b/appearance/Hypridle.qml @@ -27,6 +27,8 @@ Singleton { property string prefix: "" property var listeners: [] property string tail: "" + property string notice: "" + property bool loaded: false function getField(body, key) { const m = body.match(new RegExp(`^\\s*${key}\\s*=\\s*(.+?)\\s*$`, "m")); @@ -143,6 +145,7 @@ listener { root.prefix = p.prefix; root.listeners = p.listeners; root.tail = p.tail; + root.loaded = true; } } } @@ -150,8 +153,9 @@ listener { FileView { id: confFile; path: root.confPath } function save() { - if (root.prefix === "") return; // not loaded yet: writing would truncate the file + if (!root.loaded) return; // not loaded yet: writing would truncate the file confFile.setText(root.serialize(root.prefix, root.listeners, root.tail)); Quickshell.execDetached(["sh", "-c", "pkill -x hypridle; setsid -f hypridle"]); + root.notice = "saved; idle timers reset"; } } diff --git a/appearance/Hyprsunset.qml b/appearance/Hyprsunset.qml index ea389fd..f488e96 100644 --- a/appearance/Hyprsunset.qml +++ b/appearance/Hyprsunset.qml @@ -36,6 +36,8 @@ Singleton { property string notice: "" property string sunSummary: "" property bool busy: false + property bool confLoaded: false + property bool appLoaded: false readonly property string header: "# Managed by hyprsunset-qt. Edits here are overwritten on save.\n" @@ -160,7 +162,12 @@ profile { Process { id: confProc command: ["cat", root.confPath] - stdout: StdioCollector { onStreamFinished: root.profiles = root.parseProfiles(text) } + stdout: StdioCollector { + onStreamFinished: { + root.profiles = root.parseProfiles(text); + root.confLoaded = true; + } + } } // hyprsunset-qt's own settings: location + daemon command. @@ -194,6 +201,7 @@ profile { root.cachePathRaw = c["cache.path"] ?? "~/.config/hyprsunset-qt/sun.json"; root.cachePath = root.expandTilde(root.cachePathRaw); root.daemonCommand = c["daemon.command"] ?? "hyprsunset"; + root.appLoaded = true; } } } @@ -216,6 +224,7 @@ profile { } function save() { + if (!root.confLoaded || !root.appLoaded) return; for (const p of root.profiles) { if (!root.validTime(p.time)) { root.notice = `invalid time: ${p.time}`; return; } if (p.temperature !== null && p.temperature !== undefined && diff --git a/appearance/Icons.qml b/appearance/Icons.qml index 4c97a75..690fff2 100644 --- a/appearance/Icons.qml +++ b/appearance/Icons.qml @@ -54,7 +54,7 @@ for name in sys.argv[1:]: const icons = [], cursors = []; for (const e of entries) { if (e.cursors || e.manifest) cursors.push(e.name); - else if (e.index && /Directories=\S/.test(e.index)) icons.push(e.name); + if (e.index && /Directories=\S/.test(e.index)) icons.push(e.name); } const uniq = a => a.filter((v, i) => a.indexOf(v) === i).sort(); return { icons: uniq(icons), cursors: uniq(cursors) }; @@ -66,12 +66,14 @@ for name in sys.argv[1:]: { name: "hypr_bibata-modern-amber", index: "", cursors: false, manifest: true }, { name: "default", index: "Inherits=Bibata-Modern-Amber\n", cursors: false, manifest: false }, { name: "breeze_cursors", index: "", cursors: true, manifest: false }, + { name: "Adwaita", index: "Directories=16x16/apps\n", cursors: true, manifest: false }, ]; const r = root.classify(entries); - if (r.icons.length !== 1 || r.icons[0] !== "Material-Black-Plum-Suru") + if (r.icons.length !== 2 || r.icons.indexOf("Adwaita") < 0 || + r.icons.indexOf("Material-Black-Plum-Suru") < 0) return `SELFTEST Icons FAIL: icons ${JSON.stringify(r.icons)}`; - if (r.cursors.length !== 2 || r.cursors.indexOf("hypr_bibata-modern-amber") < 0 || - r.cursors.indexOf("breeze_cursors") < 0) + if (r.cursors.length !== 3 || r.cursors.indexOf("hypr_bibata-modern-amber") < 0 || + r.cursors.indexOf("breeze_cursors") < 0 || r.cursors.indexOf("Adwaita") < 0) return `SELFTEST Icons FAIL: cursors ${JSON.stringify(r.cursors)}`; return "SELFTEST Icons PASS"; } @@ -178,7 +180,7 @@ for name in sys.argv[1:]: `[ -s ${out} ] || exit 1;; ` + `*.svg) cp "$c" ${out};; ` + `*) rm -rf ${dir}/raw-${name}; mkdir -p ${dir}/raw-${name}; ` + - `xcur2png -d ${dir}/raw-${name} "$c" >/dev/null 2>&1; ` + + `xcur2png -d ${dir}/raw-${name} -c ${dir}/raw-${name}/out.conf "$c" >/dev/null 2>&1; ` + `cp "$(ls ${dir}/raw-${name}/$(basename "$c")_*.png | tail -1)" ${out};; esac`] curPreviewProc.running = false; curPreviewProc.running = true; diff --git a/appearance/IdleTab.qml b/appearance/IdleTab.qml index f932fac..75ce84a 100644 --- a/appearance/IdleTab.qml +++ b/appearance/IdleTab.qml @@ -87,5 +87,14 @@ Flickable { selected: true onClicked: Hypridle.save() } + + Text { + width: parent.width + wrapMode: Text.Wrap + visible: Hypridle.notice !== "" + text: Hypridle.notice + color: Theme.green + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } + } } } |
