Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion apps/blog/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions apps/desktop/src/main/lib/window-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import { MainWindow } from "../windows/main";

class WindowManager {
private windows: Set<BrowserWindow> = new Set();
private windowWorkspaces: Map<BrowserWindow, string | null> = new Map();

async createWindow(): Promise<BrowserWindow> {
const window = await MainWindow();
this.windows.add(window);
// New windows start with no workspace - user must select one
this.windowWorkspaces.set(window, null);

window.on("closed", () => {
this.windows.delete(window);
this.windowWorkspaces.delete(window);
});

return window;
Expand All @@ -22,6 +26,14 @@ class WindowManager {
getWindowCount(): number {
return this.windows.size;
}

getWorkspaceForWindow(window: BrowserWindow): string | null {
return this.windowWorkspaces.get(window) ?? null;
}

setWorkspaceForWindow(window: BrowserWindow, workspaceId: string | null): void {
this.windowWorkspaces.set(window, workspaceId);
}
Comment on lines +30 to +36
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting issue.

The formatter would reformat the setWorkspaceForWindow method. Run your formatter to resolve this warning.

Expected format:

setWorkspaceForWindow(window: BrowserWindow, workspaceId: string | null): void {
	this.windowWorkspaces.set(window, workspaceId);
}
🧰 Tools
🪛 GitHub Actions: CI

[warning] 32-34: Formatter would have printed the following content: setWorkspaceForWindow(window: BrowserWindow, workspaceId: string | null): void

🤖 Prompt for AI Agents
In apps/desktop/src/main/lib/window-manager.ts around lines 30 to 36, the
setWorkspaceForWindow method has a formatting discrepancy that the
linter/formatter flags; reformat the method to match project style (single-line
method signature with opening brace, indented body, and closing brace on its own
line) — i.e. ensure the method appears exactly as: setWorkspaceForWindow(window:
BrowserWindow, workspaceId: string | null): void
{	this.windowWorkspaces.set(window, workspaceId); } — then run the project's
formatter (e.g., prettier or eslint --fix) to apply and commit the corrected
formatting.

}

export default new WindowManager();
27 changes: 27 additions & 0 deletions apps/desktop/src/main/lib/workspace-ipcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
import configManager from "./config-manager";
import workspaceManager from "./workspace-manager";
import worktreeManager from "./worktree-manager";
import windowManager from "./window-manager";

export function registerWorkspaceIPCs() {
// Open repository dialog
Expand Down Expand Up @@ -203,6 +204,32 @@ export function registerWorkspaceIPCs() {
},
);

// Get workspace ID for the current window
ipcMain.handle("workspace-get-window-workspace-id", async (event) => {
const senderWindow = BrowserWindow.fromWebContents(event.sender);
if (!senderWindow) {
return null;
}
return windowManager.getWorkspaceForWindow(senderWindow);
});

// Set workspace ID for the current window
ipcMain.handle(
"workspace-set-window-workspace-id",
async (event, workspaceId: string | null) => {
const senderWindow = BrowserWindow.fromWebContents(event.sender);
if (!senderWindow) {
return false;
}
windowManager.setWorkspaceForWindow(senderWindow, workspaceId);
// Also update global active workspace for backward compatibility
if (workspaceId) {
await workspaceManager.setActiveWorkspaceId(workspaceId);
}
return true;
},
);

// List branches for a workspace
ipcMain.handle(
"workspace-list-branches",
Expand Down
Loading
Loading