Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions server/src/desktop/mac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ windows:

async focusChannel(channel: string): Promise<void> {
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
Expand All @@ -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<void> {
// A browser window we own: kill its app-instance pid.
const browser = this.browserWindows.get(key);
Expand Down
Loading