Skip to content

Windows shell integration: auto-inject pwsh + cmd, prompt-ready signal#445

Merged
deblasis merged 7 commits into
windowsfrom
feat/windows-shell-integration
May 30, 2026
Merged

Windows shell integration: auto-inject pwsh + cmd, prompt-ready signal#445
deblasis merged 7 commits into
windowsfrom
feat/windows-shell-integration

Conversation

@deblasis
Copy link
Copy Markdown
Owner

Auto-injected OSC 133 shell integration for the native Windows shells, plus a prompt-ready signal the app layer can react to.

What it does:

  • pwsh / PowerShell 5.1: auto-injected at launch (-NoExit -Command ". '<ghostty.ps1>'"), no $PROFILE edit. The user's profile still loads first, then the integration wraps the final prompt. Reuses the existing ghostty.ps1. Explicit user commands (pwsh -c ...) are left untouched.
  • cmd: integration via the PROMPT env var, emitting OSC 133;A / 133;B and OSC 9;9 cwd. Preserves a user-set PROMPT. No C/D marks (cmd has no command hooks).
  • New payload-less prompt_ready apprt action, dispatched on OSC 133;B (mirrors command_finished on 133;D), surfaced to C# as TerminalControl.PromptReady.
  • shell-integration config now resolves/accepts powershell and cmd.

Notes:

  • TerminalControl.PromptReady has no consumer in this repo yet; it's the hook a downstream UI feature subscribes to.
  • The .direct launch form for pwsh is deliberate so the dot-source argument survives Windows command re-parsing; bare pwsh still resolves via PATH (CreateProcessW(null, ...)).

Testing:

  • Zig: full zig build test green, including the ghostty.h action-enum ABI self-check and new setupPowerShell / setupCmd / detectShell unit tests.
  • C#: ABI ordinal pin for PromptReady + full test suite (1156 passing); native dll + app compile clean.
  • Cross-platform (macOS/Linux) compile of the new enum variants to be confirmed in CI.

@deblasis deblasis merged commit 9e99303 into windows May 30, 2026
98 checks passed
@deblasis deblasis deleted the feat/windows-shell-integration branch May 30, 2026 19:52
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