TERMINAL CORE

Shell Integration

Your shell talks to Chau7. Command boundaries, directories, exit codes. Automatically.

Questions this answers

  • How does terminal shell integration work?
  • Terminal not tracking current working directory for new tabs
  • How to detect command start and end in a terminal emulator
  • Shell integration for zsh bash fish in macOS terminal

How it works

Chau7 installs lightweight shell hooks into zsh, bash, and fish that emit invisible escape sequences (OSC 133 and OSC 7) at key points in the command lifecycle. A precmd/preexec pair marks the boundary between the prompt, the command input, and the command output. OSC 7 reports the current working directory after every directory change.

These escape sequences allow Chau7 to build a structured model of each command: the prompt region, the command text, the output region, the exit code, and the working directory at the time of execution. This model powers features like click-to-select-command-output, scroll-to-previous-prompt, and new-tab-in-same-directory.

Shell integration hooks are injected automatically when Chau7 detects a supported shell. The hooks are minimal (under 20 lines per shell) and do not modify shell behavior, aliases, or key bindings. Users who manage their own shell configuration can disable auto-injection and add the hooks manually.

Why it matters

Without shell integration, a terminal sees only a stream of characters with no structure. It cannot tell where one command ends and another begins, what the current directory is, or whether the last command succeeded. Chau7's shell integration hooks into zsh, bash, and fish to report all of this automatically, enabling features like per-command timing, directory-aware tab titles, and command-level navigation.

Frequently asked questions

Does shell integration modify my shell configuration files?

No. Chau7 injects the integration hooks at shell startup via environment variables, without modifying .zshrc, .bashrc, or config.fish. Your configuration files remain untouched.

What happens if I use a shell that is not zsh, bash, or fish?

Chau7 still functions as a standard terminal emulator. Features that depend on shell integration (command detection, directory tracking) will be unavailable, but all other functionality works normally. You can manually emit OSC 133 and OSC 7 sequences from any shell to enable integration.

Can I disable shell integration?

Yes. A single toggle in Chau7's settings disables automatic hook injection. You can also selectively disable individual features (like directory tracking) while keeping others active.