Skip to content

OSC 7 notify working directory support #24

@rzhw

Description

@rzhw

OSC 7 is an escape sequence to notify the terminal emulator of the program's current working directory. There is no formal spec for this. Efforts were made in freedesktop.org's terminal-wg, but these seem stalled.

However, OSC 7 is widely supported.

Here's macOS Sequoia's description of it:

Screenshot 2024-11-21 at 14 37 01

Here's a summary of findings I made of wider adoption (trying to justify why an existing application should print OSC 7):

Terminal Currently supported?
macOS Terminal Yes
Gnome Terminal Yes
KDE Konsole Yes
iTerm2 Yes
JetBrains JediTerm Yes
WezTerm Yes
Kitty Yes
Visual Studio Code Yes
Vim Yes
Neovim Yes
Midnight Commander Yes
Tmux Yes
Emacs Yes
Windows Terminal No (Primarily due to WSL edge cases)
Alacritty No

There also exist the related OSC 1337 proprietary to iTerm2, and OSC 633 proprietary to VSCode, and OSC 9;9 supported on Windows by ConEmu and Windows Terminal.

Not sure if it makes sense to support OSC 1337 and OSC 633, maybe it does make sense to support OSC 9;9 too?

I started work on a PR for just OSC 7, but it seems like to write unit tests charmbracelet/x/ansi also needs to support this, so I'll create this ticket first for referencing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions