From 7987be38d54a4e4d111c362836e2b57d47616a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Chaves?= Date: Sat, 13 Jun 2026 14:27:52 +0200 Subject: [PATCH] Board auto-selects a spawned room's channel via a focus marker focusChannel writes the channel slug to ~/.kanban-code/focus-channel before bringing KanbanCode forward. The app reads and drains that marker on activation and selects the channel, so the board snaps to the room you just spawned. This restores the auto-select dropped when the kanbancode:// deep link was removed to stop the quit-protection dialog: a plain marker file needs no relaunch, so the dialog stays gone. Best-effort, a write failure just means no auto-select. --- server/src/desktop/mac.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server/src/desktop/mac.ts b/server/src/desktop/mac.ts index 3ebe67c..d3c552a 100644 --- a/server/src/desktop/mac.ts +++ b/server/src/desktop/mac.ts @@ -261,6 +261,11 @@ windows: async focusChannel(channel: string): Promise { try { + // Drop the marker KanbanCode drains on activation to auto-select this + // channel, written BEFORE we bring the app forward so it's on disk when + // applicationDidBecomeActive fires. A plain file (no deep link) keeps the + // quit-dialog fix intact; a write failure just means no auto-select. + this.writeFocusMarker(channel); const region = regionForSlot("top-left", await this.screen()); // Bring the ALREADY-RUNNING KanbanCode forward via accessibility, NOT the // kanbancode:// deep link. The deep link can relaunch a stale registered @@ -285,6 +290,20 @@ windows: } } + /** + * Write the channel slug to the marker KanbanCode reads (and drains) in + * applicationDidBecomeActive to auto-select that channel. Best-effort. + */ + private writeFocusMarker(channel: string): void { + try { + const marker = path.join(os.homedir(), ".kanban-code", "focus-channel"); + fs.mkdirSync(path.dirname(marker), { recursive: true }); + fs.writeFileSync(marker, channel); + } catch { + // best effort — no marker just means no auto-select, never a broken focus + } + } + async closeWindow(key: string): Promise { // A browser window we own: kill its app-instance pid. const browser = this.browserWindows.get(key);