Skip to content

Commit ca43b55

Browse files
committed
🤖 fix: send terminal IPC events to correct window
The TERMINAL_CREATE handler was hardcoded to send events to mainWindow, but terminal windows are separate BrowserWindows that call terminal.create(). This caused terminal output to be sent to the main app window instead of the terminal window, resulting in a blank/blinking cursor with no prompt. Fix: Use BrowserWindow.fromWebContents(event.sender) to get the actual window that made the IPC call, so events are routed correctly. Generated with `mux`
1 parent 74d3274 commit ca43b55

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/ipcMain.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import assert from "@/utils/assert";
2-
import type { BrowserWindow, IpcMain as ElectronIpcMain } from "electron";
2+
import { BrowserWindow } from "electron";
3+
import type { IpcMain as ElectronIpcMain } from "electron";
34
import { spawn, spawnSync } from "child_process";
45
import * as fsPromises from "fs/promises";
56
import * as path from "path";
@@ -1475,12 +1476,11 @@ export class IpcMain {
14751476
);
14761477
}
14771478

1478-
private registerTerminalHandlers(ipcMain: ElectronIpcMain, mainWindow: BrowserWindow): void {
1479+
private registerTerminalHandlers(ipcMain: ElectronIpcMain, _mainWindow: BrowserWindow): void {
14791480
ipcMain.handle(IPC_CHANNELS.TERMINAL_CREATE, async (event, params: TerminalCreateParams) => {
14801481
try {
14811482
// Get the window that requested this terminal
1482-
// For now, all terminals use the main window (pop-out windows not yet implemented)
1483-
const senderWindow = mainWindow;
1483+
const senderWindow = BrowserWindow.fromWebContents(event.sender);
14841484
if (!senderWindow) {
14851485
throw new Error("Could not find sender window for terminal creation");
14861486
}

0 commit comments

Comments
 (0)