From 34646dec285e6798572df7cccc1625369918490c Mon Sep 17 00:00:00 2001 From: felixzsh Date: Tue, 11 Aug 2026 14:03:12 -0500 Subject: [PATCH] Fix pause toggle: never delete the flag file The FileView watcher fires on content changes but not on deletion, so resuming (rm of the flag) left the panel and the menu stuck paused. Rewrite the flag with 0 or 1 instead, matching the state-file pattern that already works. --- KeyVisualizer.qml | 4 +++- Panel.qml | 5 ++++- manifest.json | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/KeyVisualizer.qml b/KeyVisualizer.qml index fa18752..982f7e3 100644 --- a/KeyVisualizer.qml +++ b/KeyVisualizer.qml @@ -166,9 +166,11 @@ Item { function setPaused(p) { if (p === root.paused) return + // Always rewrite the flag with "0" or "1", never delete it: the + // FileView watcher fires on content changes but not on deletion. var cmd = p ? "printf 1 > " + Util.shellQuote(root.pausePath) - : "rm -f " + Util.shellQuote(root.pausePath) + : "printf 0 > " + Util.shellQuote(root.pausePath) pauseToggleProc.command = ["sh", "-c", cmd] pauseToggleProc.running = true } diff --git a/Panel.qml b/Panel.qml index e07769a..3c24dcf 100644 --- a/Panel.qml +++ b/Panel.qml @@ -41,9 +41,12 @@ Panel { function setPaused(p) { if (p === root.paused) return + // The flag file is always rewritten with "0" or "1" — never deleted: + // the FileView watcher fires on content changes but not on deletion, so + // a removed flag would leave the toggle stuck. var cmd = p ? "printf 1 > " + Util.shellQuote(root.pausePath) - : "rm -f " + Util.shellQuote(root.pausePath) + : "printf 0 > " + Util.shellQuote(root.pausePath) toggleProc.command = ["sh", "-c", cmd] toggleProc.running = true } diff --git a/manifest.json b/manifest.json index ee743cd..7e20900 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "id": "felixzsh.key-visualizer", "name": "Key Visualizer", - "version": "1.3.2", + "version": "1.3.3", "description": "Shows the keys you press on screen. Great for keybinding tutorials, demos, and screencasts.", "kinds": [ "panel",