From 45201bc376a59126d3b07dd83f41bc5ab2de7885 Mon Sep 17 00:00:00 2001 From: pdmarf <135653545+pdmarf@users.noreply.github.com> Date: Tue, 25 Aug 2026 16:27:46 +0100 Subject: [PATCH] v1.0.43: self-heal stale button icon when blocked by the keyDown lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a keyDown is blocked by the v1.0.42 lock, redraw that button to match memRunningActionId instead of leaving whatever it was already showing. This closes the follow-on issue found while testing 1.0.42: a button's key image can go stale if its Notion timer was ever stopped/started outside the plugin (e.g. a manual Notion edit), and a blocked press was leaving that stale image in place — misleading the user into thinking a timer was running when it wasn't, which then caused a *real* unintended timer start on the next press. --- com.pdma.notion-timer.sdPlugin/bin/plugin.js | 12 ++++++++++-- com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig | 4 +++- src/plugin.ts | 15 +++++++++++++-- version.json | 2 +- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js b/com.pdma.notion-timer.sdPlugin/bin/plugin.js index 0aecbf0..d1f5d27 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js @@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) { } // src/plugin.ts -var CURRENT_VERSION = "1.0.42"; +var CURRENT_VERSION = "1.0.43"; var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= @@ -6637,7 +6637,15 @@ var TimerToggle = class extends SingletonAction { await sendProjectsToPI(); } async onKeyDown(ev) { - if (this.keyDownBusy) return; + if (this.keyDownBusy) { + const title = buttonTitle(ev.payload.settings.projectName || ""); + const shouldBeRunning = memRunningActionId === ev.action.id; + await Promise.all([ + ev.action.setState(shouldBeRunning ? 1 : 0), + ev.action.setTitle(shouldBeRunning ? `\u23F1 ${title}` : title) + ]); + return; + } this.keyDownBusy = true; try { const { projectId, projectName } = ev.payload.settings; diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig index b626d78..d73511c 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig @@ -1 +1,3 @@ -HeÒ¾à�¡21™ßC'Ý—ÿ9ƒx¤,$2&úöö¡rÅYËb’L¸ËeìÉ.ËQ:¶þõub;B™¢& \ No newline at end of file +íü„«ÚƒJºh^©A׊[ÈÍ +Ìg»Jµmã +SÙ¹mš']ï´y�j$¬<ÎÇÙÃ5ef «?eó=™y– \ No newline at end of file diff --git a/src/plugin.ts b/src/plugin.ts index a42f5aa..29a17e4 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,4 +1,4 @@ -const CURRENT_VERSION = "1.0.42"; +const CURRENT_VERSION = "1.0.43"; const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= @@ -243,7 +243,18 @@ class TimerToggle extends SingletonAction { // Global lock across ALL buttons of this action, not just this one — otherwise // near-simultaneous presses on two different buttons both read memRunningActionId // as "nothing running" and both start a timer in Notion. - if (this.keyDownBusy) return; + if (this.keyDownBusy) { + // Blocked press: redraw THIS button to match known truth instead of leaving + // whatever it was already showing (which can be stale from an out-of-band + // Notion edit) — a pure visual correction, no Notion calls. + const title = buttonTitle(ev.payload.settings.projectName || ""); + const shouldBeRunning = memRunningActionId === ev.action.id; + await Promise.all([ + ev.action.setState(shouldBeRunning ? 1 : 0), + ev.action.setTitle(shouldBeRunning ? `â�± ${title}` : title), + ]); + return; + } this.keyDownBusy = true; try { const { projectId, projectName } = ev.payload.settings; diff --git a/version.json b/version.json index ff87f4e..431bac7 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "1.0.42" } +{ "version": "1.0.43" }