diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js b/com.pdma.notion-timer.sdPlugin/bin/plugin.js index 7ed3b9a..4415608 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.51"; +var CURRENT_VERSION = "1.0.52"; 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= @@ -6718,8 +6718,29 @@ var TimerToggle = class extends SingletonAction { TimerToggle = __decorateClass([ action({ UUID: "com.pdma.notion-timer.toggle" }) ], TimerToggle); +var NEXTCLOUD_BIN = "/Applications/Nextcloud.app/Contents/MacOS/Nextcloud"; +var LaunchNextcloud = class extends SingletonAction { + async onKeyDown(ev) { + try { + const { spawn } = await import("node:child_process"); + const child = spawn(NEXTCLOUD_BIN, [], { detached: true, stdio: "ignore" }); + child.once("error", (err) => { + plugin_default.logger.error("Failed to launch Nextcloud:", err); + }); + child.unref(); + await ev.action.showOk(); + } catch (err) { + plugin_default.logger.error("Failed to launch Nextcloud:", err); + await ev.action.showAlert(); + } + } +}; +LaunchNextcloud = __decorateClass([ + action({ UUID: "com.pdma.notion-timer.launch-nextcloud" }) +], LaunchNextcloud); var timerAction = new TimerToggle(); plugin_default.actions.registerAction(timerAction); +plugin_default.actions.registerAction(new LaunchNextcloud()); plugin_default.ui.onSendToPlugin(async (ev) => { if (ev.payload.event === "saveSettings" && ev.payload.settings) { await ev.action.setSettings(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 dcabfd0..e9dded7 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig @@ -1 +1 @@ -…æË>· o“ˆ!óhŰù!HC1ÈÉÒÉ_gY’|vnû¦»­÷1Ûá´¨*ò�˜M(ªºþ0C5ó= \ No newline at end of file +Iø®Q½‡ä”à¸ýN¸œg¾�Öë̇­è Ò-�œ×êÄmÏŹ÷0螟¦r([ŽÂŒ–Ý”v’VwL•‰¬ \ No newline at end of file diff --git a/com.pdma.notion-timer.sdPlugin/imgs/nextcloud-icon.png b/com.pdma.notion-timer.sdPlugin/imgs/nextcloud-icon.png new file mode 100644 index 0000000..e43108e Binary files /dev/null and b/com.pdma.notion-timer.sdPlugin/imgs/nextcloud-icon.png differ diff --git a/com.pdma.notion-timer.sdPlugin/imgs/nextcloud-icon.svg b/com.pdma.notion-timer.sdPlugin/imgs/nextcloud-icon.svg new file mode 100644 index 0000000..1c1414f --- /dev/null +++ b/com.pdma.notion-timer.sdPlugin/imgs/nextcloud-icon.svg @@ -0,0 +1,5 @@ + + + + diff --git a/com.pdma.notion-timer.sdPlugin/manifest.json b/com.pdma.notion-timer.sdPlugin/manifest.json index 3c54c51..c47e01a 100644 --- a/com.pdma.notion-timer.sdPlugin/manifest.json +++ b/com.pdma.notion-timer.sdPlugin/manifest.json @@ -2,7 +2,7 @@ "Author": "Pete Marfleet", "Description": "Toggle Notion time tracking for a project with a single button press.", "Name": "Notion Timer", - "Version": "1.0.39", + "Version": "1.0.40", "SDKVersion": 2, "Software": { "MinimumVersion": "5.0" }, "OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }], @@ -30,6 +30,19 @@ ], "PropertyInspectorPath": "ui/property-inspector.html", "SupportedInMultiActions": false + }, + { + "Icon": "imgs/nextcloud-icon", + "Name": "Launch Nextcloud", + "UUID": "com.pdma.notion-timer.launch-nextcloud", + "Tooltip": "Launch the Nextcloud desktop client in the background.", + "States": [ + { + "Image": "imgs/nextcloud-icon", + "TitleAlignment": "bottom" + } + ], + "SupportedInMultiActions": false } ] } diff --git a/notion-timer.streamDeckPlugin b/notion-timer.streamDeckPlugin index 8e5c3ef..72198d9 100644 Binary files a/notion-timer.streamDeckPlugin and b/notion-timer.streamDeckPlugin differ diff --git a/src/plugin.ts b/src/plugin.ts index 83655d2..6590c20 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,4 +1,4 @@ -const CURRENT_VERSION = "1.0.51"; +const CURRENT_VERSION = "1.0.52"; 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= @@ -333,8 +333,31 @@ class TimerToggle extends SingletonAction { } } +const NEXTCLOUD_BIN = "/Applications/Nextcloud.app/Contents/MacOS/Nextcloud"; + +@action({ UUID: "com.pdma.notion-timer.launch-nextcloud" }) +class LaunchNextcloud extends SingletonAction { + async onKeyDown(ev: KeyDownEvent): Promise { + try { + const { spawn } = await import("node:child_process"); + const child = spawn(NEXTCLOUD_BIN, [], { detached: true, stdio: "ignore" }); + // "error" (e.g. ENOENT if Nextcloud isn't installed at this path) fires + // asynchronously — without this listener it would crash the plugin process. + child.once("error", (err) => { + streamDeck.logger.error("Failed to launch Nextcloud:", err); + }); + child.unref(); + await ev.action.showOk(); + } catch (err) { + streamDeck.logger.error("Failed to launch Nextcloud:", err); + await ev.action.showAlert(); + } + } +} + const timerAction = new TimerToggle(); streamDeck.actions.registerAction(timerAction); +streamDeck.actions.registerAction(new LaunchNextcloud()); streamDeck.ui.onSendToPlugin<{ event: string; settings?: TimerSettings; token?: string }>(async (ev) => { if (ev.payload.event === "saveSettings" && ev.payload.settings) { diff --git a/version.json b/version.json index 272ea99..b2acd97 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "1.0.51" } +{ "version": "1.0.52" }