Escape sequences
Programs talk to the terminal through escape sequences. The ones that begin with ESC ]
are OSC sequences: they set the title, send a notification, mark a link, reach the
clipboard. This page lists the ones Cogno understands.
Supported sequences
Section titled “Supported sequences”| Sequence | What it does |
|---|---|
OSC 0, OSC 2 | Set the title of the tab. The title shows only while the command that set it runs. |
OSC 4, OSC 104 | Set, query or reset one of the 256 palette colors. |
OSC 10, 11, 12 | Set or query the foreground, background and cursor color. |
OSC 110, 111, 112 | Reset the foreground, background and cursor color. |
OSC 8 | Hyperlink: text that leads somewhere else. |
OSC 9 | Send a notification. |
OSC 9;4 | Show progress in the terminal’s header. |
OSC 52 | Read or write the clipboard. |
OSC 777;notify | Send a notification with a title. |
OSC 1337;File | Show an image (iTerm2’s protocol). Off by default. |
| Sixel | Show an image (DCS q, not an OSC sequence). Off by default. |
Everything else is ignored.
Hyperlinks
Section titled “Hyperlinks”A program can make any text a link, the way ls --hyperlink or gcc do:
printf '\e]8;;https://example.com\e\\This is a link\e]8;;\e\\\n'These links behave like the URLs and paths Cogno finds in the output by itself: a click
copies the target, Ctrl+click (Cmd+click on macOS) opens it. The text of such a link
does not show where it leads, so hover it first: the tooltip shows the target.
Cogno opens http, https and mailto links. A file link opens like a path printed in
the output. Links of any other kind can only be copied.
Notifications and progress
Section titled “Notifications and progress”printf '\e]9;Build finished\a' # a messageprintf '\e]777;notify;Build;3 warnings\a' # a message with a titleprintf '\e]9;4;1;40\a' # progress: 40 %printf '\e]9;4;0\a' # progress: done, hide itNotifications from programs are off by default. Switch them on, and choose where they show up, in the notification settings:
notification.source.terminal.osc9.enabled = trueThe progress states are 1 normal, 2 error, 3 indeterminate, 4 warning and 0
hidden. Hide the bar altogether with terminal.progress_bar.enabled = false.
Other numbered OSC 9 commands from ConEmu and Windows Terminal, such as 9;9 for the
working directory, are ignored. They do not show up as notifications.
Clipboard
Section titled “Clipboard”With OSC 52 a program can copy to your clipboard and read from it. This is how copying
works in vim or tmux over SSH. But anything printed in the terminal can ask for your
clipboard, even a file you cat.
So before a program may read your clipboard, Cogno asks you in a dialog:
clipboard.read = ask # ask (default), allow or denyclipboard.write = allow # allow (default) or denyThese settings only affect programs, not your own copy and paste.
Images
Section titled “Images”Programs can print images into the terminal: imgcat and others with iTerm2’s
OSC 1337, img2sixel, chafa and many plotting tools with sixel. Cogno shows them when
you switch it on:
terminal.images.enabled = trueterminal.images.storage_limit_mb = 32Each terminal keeps up to storage_limit_mb megabytes of images. When that is full, the
oldest images are replaced by a placeholder. Images are not restored with a session.
Settings
Section titled “Settings”clipboard.*: what programs may do with the clipboardnotification.source.terminal.osc9.enabled: whether a program’s message notifies youterminal.progress_bar.*: the progress bar in the headerterminal.images.*: images in the output