diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-30 20:39:14 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-30 20:39:14 +0100 |
| commit | 7543de352143e1d09df5ba3e265311d52a60840d (patch) | |
| tree | 9c78bcf18d402ea3f1708b2ca7d453ebf22e36a8 /desktop/modules/monitors | |
| parent | 3c747053dd140ba4f2d53155939e4a895ec8c6e9 (diff) | |
| download | quickshell-7543de352143e1d09df5ba3e265311d52a60840d.tar.gz quickshell-7543de352143e1d09df5ba3e265311d52a60840d.zip | |
monitors: report Keep's write, resync without the autoreload
"saved" now waits for FileView's saved, and a failed write shows its
error: the change is live but the next reload would bring the old file
back. Keep sets orig from the draft itself rather than relying on the
autoreload's read, apply() clears a skipRead a refusal's reload never
consumed, and an unreadable hyprctl reply says so instead of showing an
empty page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/monitors')
| -rw-r--r-- | desktop/modules/monitors/MonitorsModule.qml | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/desktop/modules/monitors/MonitorsModule.qml b/desktop/modules/monitors/MonitorsModule.qml index 3ed9b22..94ec8e4 100644 --- a/desktop/modules/monitors/MonitorsModule.qml +++ b/desktop/modules/monitors/MonitorsModule.qml @@ -62,7 +62,7 @@ Module { stdout: StdioCollector { onStreamFinished: { let list; - try { list = JSON.parse(this.text); } catch (e) { return; } + try { list = JSON.parse(this.text); } catch (e) { mm.error = "Cannot read hyprctl monitors."; return; } mm.orig = list.map(M.draft); mm.draft = list.map(M.draft); } @@ -89,6 +89,8 @@ Module { } function apply() { + // A refusal's reload that never reported must not eat a later one. + mm.skipRead = false; mm.error = ""; mm.notice = ""; applyProc.command = ["sh", "-c", 'for l; do hyprctl eval "$l" || exit 7; done', "sh"] @@ -124,7 +126,8 @@ Module { tick.stop(); mm.pending = false; fv.setText(M.file(mm.draft)); - mm.notice = "saved"; + // The draft is what is live; not left to the autoreload's read. + mm.orig = JSON.parse(JSON.stringify(mm.draft)); } // Also what leaving the page while pending does. @@ -138,6 +141,9 @@ Module { path: mm.file atomicWrites: true printErrors: false + onSaved: mm.notice = "saved" + // Live but not on disk: the next reload would bring the old file back. + onSaveFailed: err => mm.error = "Cannot write monitors.lua: " + FileViewError.toString(err) } Component.onCompleted: mm.read() |
