Skip to content

Commit 4846517

Browse files
authored
fix: hide electron process from tray (#185)
1 parent 0f4f199 commit 4846517

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

packages/agent/src/adapters/claude/claude.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,13 @@ export class ClaudeAcpAgent implements Agent {
341341
allowDangerouslySkipPermissions: !IS_ROOT,
342342
permissionMode,
343343
canUseTool: this.canUseTool(sessionId),
344-
// note: although not documented by the types, passing an absolute path
345-
// here works to find zed's managed node version.
346-
executable: process.execPath as any,
344+
// Use "node" to resolve via PATH where a symlink to Electron exists.
345+
// This avoids launching the Electron binary directly from the app bundle,
346+
// which can cause dock icons to appear on macOS even with ELECTRON_RUN_AS_NODE.
347+
executable: "node",
348+
// Prevent spawned Electron processes from showing in dock/tray.
349+
// Must merge with process.env since SDK replaces rather than merges.
350+
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },
347351
...(process.env.CLAUDE_CODE_EXECUTABLE && {
348352
pathToClaudeCodeExecutable: process.env.CLAUDE_CODE_EXECUTABLE,
349353
}),
@@ -986,7 +990,13 @@ export class ClaudeAcpAgent implements Agent {
986990
permissionMode,
987991
canUseTool: this.canUseTool(sessionId),
988992
stderr: (err) => this.logger.error(err),
989-
executable: process.execPath as any,
993+
// Use "node" to resolve via PATH where a symlink to Electron exists.
994+
// This avoids launching the Electron binary directly from the app bundle,
995+
// which can cause dock icons to appear on macOS even with ELECTRON_RUN_AS_NODE.
996+
executable: "node",
997+
// Prevent spawned Electron processes from showing in dock/tray.
998+
// Must merge with process.env since SDK replaces rather than merges.
999+
env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },
9901000
...(process.env.CLAUDE_CODE_EXECUTABLE && {
9911001
pathToClaudeCodeExecutable: process.env.CLAUDE_CODE_EXECUTABLE,
9921002
}),

0 commit comments

Comments
 (0)