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.
This commit is contained in:
+3
-1
@@ -166,9 +166,11 @@ Item {
|
|||||||
|
|
||||||
function setPaused(p) {
|
function setPaused(p) {
|
||||||
if (p === root.paused) return
|
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
|
var cmd = p
|
||||||
? "printf 1 > " + Util.shellQuote(root.pausePath)
|
? "printf 1 > " + Util.shellQuote(root.pausePath)
|
||||||
: "rm -f " + Util.shellQuote(root.pausePath)
|
: "printf 0 > " + Util.shellQuote(root.pausePath)
|
||||||
pauseToggleProc.command = ["sh", "-c", cmd]
|
pauseToggleProc.command = ["sh", "-c", cmd]
|
||||||
pauseToggleProc.running = true
|
pauseToggleProc.running = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,12 @@ Panel {
|
|||||||
|
|
||||||
function setPaused(p) {
|
function setPaused(p) {
|
||||||
if (p === root.paused) return
|
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
|
var cmd = p
|
||||||
? "printf 1 > " + Util.shellQuote(root.pausePath)
|
? "printf 1 > " + Util.shellQuote(root.pausePath)
|
||||||
: "rm -f " + Util.shellQuote(root.pausePath)
|
: "printf 0 > " + Util.shellQuote(root.pausePath)
|
||||||
toggleProc.command = ["sh", "-c", cmd]
|
toggleProc.command = ["sh", "-c", cmd]
|
||||||
toggleProc.running = true
|
toggleProc.running = true
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "felixzsh.key-visualizer",
|
"id": "felixzsh.key-visualizer",
|
||||||
"name": "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.",
|
"description": "Shows the keys you press on screen. Great for keybinding tutorials, demos, and screencasts.",
|
||||||
"kinds": [
|
"kinds": [
|
||||||
"panel",
|
"panel",
|
||||||
|
|||||||
Reference in New Issue
Block a user