Skip to content

fix(open-in-apps): Improve Windows compatibility and command handling#2081

Open
anglox wants to merge 2 commits into
generalaction:mainfrom
anglox:fix/improve-windows-compatibility
Open

fix(open-in-apps): Improve Windows compatibility and command handling#2081
anglox wants to merge 2 commits into
generalaction:mainfrom
anglox:fix/improve-windows-compatibility

Conversation

@anglox
Copy link
Copy Markdown

@anglox anglox commented May 18, 2026

This PR improves cross-platform reliability of the “Open in App” system, with a focus on fixing Windows execution issues and aligning command resolution behavior across platforms.

  • Unix-only command -v and Windows-compatible where
  • Updated quoting logic to be platform-aware:
    • POSIX: single-quoted shell escaping
    • Windows: double-quoted escaping
  • Removed Windows start "" wrappers in favor of direct executable calls
  • Zed integration improvements
    • Added Windows support for Zed launch commands
    • Marked Zed as supporting remote workflows
    • Added zed://ssh/... scheme handling for remote SSH paths

Issues addressed:

  1. No tools detected on Windows even though I have some of them
  2. Opening a detected tool on Windows spawns redundant shell
image

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR improves Windows compatibility for the "Open in App" feature by replacing command -v with platform-conditional detection (where on Windows, command -v on POSIX), removing redundant start "" shell wrappers, and adding platform-aware path quoting. It also adds Zed Windows support and wires Zed into the remote SSH URL builder.

  • Platform detection: checkCommand now uses where on win32 and command -v elsewhere, fixing the breakage on Windows where command -v is not available.
  • Quoting: The quoted() helper is now platform-aware — POSIX single-quote escaping on non-Windows, CMD-style "" double-quote escaping on Windows.
  • Zed remote: buildRemoteEditorUrl gained a 'zed' switch arm emitting zed://ssh/... URLs, and openInRemote now routes Zed through that builder (previously fell through to the "not yet implemented" error).

Confidence Score: 5/5

Safe to merge — all previously identified issues are addressed and no new defects were found.

The conditional where/command -v split correctly fixes Windows app detection without breaking macOS or Linux. The CMD-style "" quoting is the right approach for cmd.exe. Removing start "" is appropriate since the Electron main process has no terminal window to detach from, and the CLI tools being invoked (code, cursor, etc.) return promptly on their own. The Zed remote SSH path is now fully wired end-to-end: supportsRemote: trueopenInRemote branch → buildRemoteEditorUrl 'zed' arm.

No files require special attention.

Important Files Changed

Filename Overview
src/main/core/app/utils.ts Adds platform-conditional command detection: where on Windows, command -v on POSIX. Correct and minimal — where.exe is always available in System32 on Windows, and the callback only checks the exit code so uncaptured stdout from where is harmless.
src/main/core/app/service.ts Adds 'zed' to the remote-SSH URL-builder branch (fixing the previous "not yet implemented" fallthrough) and introduces platform-aware quoted() — POSIX single-quote escaping vs CMD-style "" double-quote escaping on Windows.
src/main/utils/remoteOpenIn.ts Extends RemoteEditorScheme with 'zed' and adds a switch arm in buildRemoteEditorUrl that emits zed://ssh/<authority>/<path> rather than the VS Code vscode-remote scheme.
src/shared/openInApps.ts Removes start "" <app> wrappers from all Windows openCommands entries, marks Zed as supportsRemote: true, and adds a win32 platform block for Zed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[openInApp] --> B{Has URL schemes?}
    B -- Yes --> C[shell.openExternal URL]
    B -- No --> D[Build quoted path]
    D --> E{platform}
    E -- win32 --> F[double-quote with CMD escaping]
    E -- posix --> G[single-quote with POSIX escaping]
    F & G --> H[Replace path in openCommands]
    H --> I[exec command]

    J[openInRemote] --> K{appId}
    K -- vscode/vscodium/cursor/zed --> L[buildRemoteEditorUrl]
    L --> M{scheme}
    M -- zed --> N[zed://ssh/authority/path]
    M -- default --> O[scheme://vscode-remote/ssh-remote+authority/path]
    N & O --> P[shell.openExternal]

    Q[checkCommand] --> R{platform}
    R -- win32 --> S[exec: where cmd]
    R -- non-win32 --> T[exec: command -v cmd]
    S & T --> U[resolve by exit code]
Loading

Reviews (3): Last reviewed commit: "fix(open-in-apps): platform-aware check ..." | Re-trigger Greptile

Comment thread src/main/core/app/utils.ts
Comment thread src/main/core/app/utils.ts Outdated
Comment thread src/main/core/app/service.ts Outdated
@anglox anglox marked this pull request as draft May 18, 2026 01:28
@anglox anglox marked this pull request as ready for review May 18, 2026 01:46
@anglox
Copy link
Copy Markdown
Author

anglox commented May 18, 2026

@greptileai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant