Automatic shell integration for zsh, fish and PowerShell - #1923
Merged
Merged
Conversation
raphamorim
force-pushed
the
shell-integration-v2
branch
from
September 17, 2026 18:53
a81987d to
e060090
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rio's title path variables and cwd inheritance rely on the shell reporting its working directory, but until now that required the user to configure their shell. This PR makes it work out of the box on every platform:
ZDOTDIRfor zsh (the user's value is preserved and restored before any of their configuration runs, and their real.zshenvis chained first) and anXDG_DATA_DIRSprepend for fish (vendor_conf.d). The scripts emit OSC 7 on every prompt and directory change and are original to rio.-NoExit -Command . '<script>', running after the user's profile, the same mechanism VS Code uses for automatic injection. Configured shell args win over integration and skip the rewrite. The script wraps the prompt function and emits the cwd as afile://URI, so spaces and UNC paths are handled by the existing parser rules (remote UNC hosts are refused).kitty-shell-cwd://scheme (a raw, unencoded path), so existing kitty-style shell integrations work with rio unchanged.OSC 9;9(ConEmu/Windows Terminal working directory) is parsed as a cwd report. Previously it fell into the desktop-notification fallback and produced a bogus notification; now any existing Windows Terminal$PROFILEworks with rio as-is.create_pty_with_forkgained an env parameter so the fork spawn path (use-fork = true) injects the same environment as the spawn path; the Windows ConPTY path already supported env blocks and needed no teletypewriter change.shell-integration(defaulttrue) disables the injection entirely.Out of scope: bash needs
--posixplusENVargv surgery, cmd.exe only offers a machine-wide registry AutoRun (too invasive; clink users can source a snippet), nushell's vendor autoload story is still settling across versions, and WSL needsWSLENVplumbing. All are documented paths for a follow-up.Tests: parser acceptance/verbatim/host-rejection for
kitty-shell-cwd://,OSC 9;9parsing (quoted paths,;rejoin, non-collision with progress reports), per-shell env mapping, cross-platform shell-name normalization, PowerShell path quoting, and idempotent script materialization.