v1.0.52: add Launch Nextcloud button

Spawns the Nextcloud.app binary directly (detached, no Terminal window)
since it doesn't register properly with launch services on some setups.
New action requires a one-time plugin reinstall (manifest changes don't
ship through the OTA updater, which only touches plugin.js + assets).
This commit is contained in:
pdmarf
2026-10-07 18:15:08 +01:00
parent 0b4345dad6
commit 4a7ed58410
8 changed files with 67 additions and 5 deletions
+24 -1
View File
@@ -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<TimerSettings> {
}
}
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<void> {
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) {