From 62d5af3b1ec8f32c4dfe497c05f12b330406dd34 Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Sun, 30 Nov 2025 00:04:33 +0100 Subject: [PATCH] Open terminal in currently active workspace --- src/main/fileOperations.ts | 4 ++++ src/main/pty.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/fileOperations.ts b/src/main/fileOperations.ts index d7f4147..cc30b99 100644 --- a/src/main/fileOperations.ts +++ b/src/main/fileOperations.ts @@ -19,6 +19,10 @@ type FolderTree = { let currentWorkspaceRoot: string | null = null; let watcher: chokidar.FSWatcher | null = null; +export function getCurrentWorkspaceRoot(): string | null { + return currentWorkspaceRoot; +} + // Helper to (re)create watcher and wire up IPC notifications to renderer function ensureWatcher() { if (watcher) return watcher; diff --git a/src/main/pty.ts b/src/main/pty.ts index 62e6d5c..b761a8d 100644 --- a/src/main/pty.ts +++ b/src/main/pty.ts @@ -1,4 +1,5 @@ import * as pty from "node-pty"; +import { getCurrentWorkspaceRoot } from "./fileOperations"; export interface TerminalInstance { ptyProcess: pty.IPty; @@ -24,7 +25,7 @@ export class TerminalManager { name: "xterm-color", cols: 80, rows: 24, - cwd: process.cwd(), + cwd: getCurrentWorkspaceRoot() || process.cwd(), env: process.env, });