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:
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.
OSC 7is 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 7is widely supported.Here's macOS Sequoia's description of it:
Here's a summary of findings I made of wider adoption (trying to justify why an existing application should print
OSC 7):There also exist the related
OSC 1337proprietary to iTerm2, andOSC 633proprietary to VSCode, andOSC 9;9supported on Windows by ConEmu and Windows Terminal.Not sure if it makes sense to support
OSC 1337andOSC 633, maybe it does make sense to supportOSC 9;9too?I started work on a PR for just
OSC 7, but it seems like to write unit testscharmbracelet/x/ansialso needs to support this, so I'll create this ticket first for referencing.