❯_termy
Reference

Terminal protocols

Escape sequences, modes, queries, and extensions the Termy engine understands.

This page lists what Termy's terminal engine implements. The same engine runs the desktop app, libtermy, and the @termysh web packages, so programs see the same behavior everywhere. TERM defaults to xterm-256color (see the term setting), and XTGETTCAP always reports that name.

Sequences that are not listed here are ignored without affecting the screen.

Extensions

ProtocolSequenceNotes
Program statusOSC 7501Revision 0.3. Reports idle, working, blocked, done, or error. OSC 7501 ; ? ST replies ESC ] 7501 ; ? ESC \.
ProgressOSC 9 ; 4 ; state ; valueConEmu/Windows Terminal progress. States 0 clear, 1 in progress, 2 error, 3 indeterminate, 4 warning.
Kitty graphicsAPC G … STChunked RGB/RGBA/PNG uploads, zlib, file and shared-memory transfers, placements, deletion, Unicode placeholders, relative placements, and animation.
Kitty keyboardCSI ? u, CSI > u, CSI < u, CSI = uAll five progressive-enhancement flags. The primary and alternate screens keep separate flag stacks, up to 32 entries each.
Kitty clipboardOSC 5522, mode ?5522Multi-format clipboard reads and writes, and paste events.
Synchronized outputmode ?2026Output is held until the update ends, for up to 150 ms or 2 MiB.
HyperlinksOSC 8 ; params ; uri STSupports the id= parameter.
ClipboardOSC 52 ; targets ; data STWrites are always allowed. Reads (data = ?) follow the clipboard_read setting.
Shell integrationOSC 133 ; A/B/C/DPrompt start, command start, command executing, and command finished with an optional exit code. Always parsed; shell_integration_enabled only controls the environment Termy passes to shells.
Working directoryOSC 7 ; file://host/path ST, OSC 9 ; 9 ; path STPercent-encoded file:// URLs are decoded; a path with a literal % is kept as written. Other URL schemes are ignored.
Window titleOSC 0, OSC 2, CSI 22 t, CSI 23 tTitle stack holds up to 64 entries. OSC 1 (icon title) is ignored.

Colors

SequenceNotes
OSC 4 ; index ; specSet or query (?) palette entries 0–255.
OSC 10, OSC 11, OSC 12Set or query foreground, background, and cursor colors. Without a cursor color, the cursor query reports the foreground.
OSC 104, OSC 110, OSC 111, OSC 112Reset palette entries, foreground, background, and cursor color.

Color specs accept #rgb through #rrrrggggbbbb and rgb:r/g/b with one to four hex digits per component. Replies use rgb:rrrr/gggg/bbbb and end with the query's terminator (BEL or ST).

Text attributes (SGR)

CodesEffect
0Reset (keeps DECSCA protection)
1, 2, 22Bold, dim, normal intensity
3, 23Italic on/off
4, 21, 24Underline, double underline, no underline
4:0–4:5None, single, double, curly, dotted, dashed underline
5, 6, 25Blink on/off
7, 27Inverse on/off
8, 28Hidden on/off
9, 29Strikethrough on/off
30–37, 90–97, 39Foreground: palette, bright palette, default
40–47, 100–107, 49Background: palette, bright palette, default
38, 48, 58Extended foreground, background, underline color: 5;n or 2;r;g;b, with ; or : separators
59Default underline color

Modes

Set with CSI ? n h, reset with CSI ? n l. Every mode below can be queried with DECRQM (CSI ? n $ p). Except for 3, 1048, and 2027, each can also be saved and restored with XTSAVE (CSI ? n s) and XTRESTORE (CSI ? n r).

ModeName
1Application cursor keys (DECCKM)
3DECCOLM: clears the screen and resets margins; does not resize
5Reverse video (DECSCNM): swaps the default foreground and background (explicitly colored cells keep their colors)
6Origin mode (DECOM)
7Autowrap (DECAWM)
69Left/right margin mode (DECLRMM): enables DECSLRM; resetting it resets the margins
9X10 mouse reporting
12Cursor blinking
25Cursor visible (DECTCEM)
47, 1047, 1049Alternate screen; 1049 also saves the cursor and clears on entry, including when 47/1047 already switched screens
1048Save/restore cursor; DECRQM reports whether a cursor is saved
1000, 1002, 1003Mouse click, drag, and motion tracking; resetting any of 9, 1000, 1002, 1003 turns tracking off
1004Focus in/out events
1005, 1006Mouse encoding: UTF-8, SGR. urxvt (1015) is not supported and reports 0
1007Alternate scroll: the host may send wheel motion as cursor keys on the alternate screen when no mouse tracking is active
1016SGR pixel mouse encoding. Recognized only where the host reports pointer pixels: the engine C library with pixel_mouse_reports. Elsewhere, including the Termy app, it is not supported and reports 0
2004Bracketed paste
2026Synchronized output
2027Grapheme clustering: always on; DECRQM reports 3 (permanently set)
5522Kitty clipboard paste events

ANSI modes 4 (insert, IRM) and 20 (line feed/new line, LNM) use CSI n h/CSI n l and are reportable with CSI n $ p.

Queries and replies

QuerySequenceReply
Primary device attributesCSI c, ESC ZCSI ? 62 ; 22 c
Secondary device attributesCSI > cCSI > 1 ; 1 ; 0 c
Terminal name and version (XTVERSION)CSI > q, CSI > 0 qDCS > | Termy version ST, with the engine's version
Device statusCSI 5 nCSI 0 n
Cursor positionCSI 6 n, CSI ? 6 nCSI row ; col R, relative to the margins in origin mode
Mode reportCSI ? n $ p, CSI n $ pCSI ? n ; status $ y
Kitty keyboard flagsCSI ? uCSI ? flags u
Text area size in pixelsCSI 14 tCSI 4 ; height ; width t
Cell size in pixelsCSI 16 tCSI 6 ; height ; width t
Text area size in cellsCSI 18 tCSI 8 ; rows ; cols t
DECRQSSDCS $ q Pt STSGR (m), scroll region (r), left/right margins (s), cursor style ( q), protection ("q), and conformance level ("p)
XTGETTCAPDCS + q names STCo/colors (256), TN/name (xterm-256color), RGB (8), and, in terminfo notation, Smulx (styled underlines), Setulc (underline color), and Ms (OSC 52 clipboard writes)
ColorOSC 4, OSC 10–12 with ?See Colors
Program statusOSC 7501 ; ?OSC 7501 ; ? ST

Cursor, editing, and screen control

SequenceFunction
CSI A/B/C/D, CSI e, CSI aCursor up, down, forward, back; VPR, HPR
CSI E/FCursor next/previous line
CSI G, CSI `, CSI d, CSI H, CSI fColumn, row, and absolute positioning
CSI I, CSI Z, ESC H, CSI gTab forward/back, set tab stop, clear tab stops (0, 3)
CSI J, CSI K, CSI ? J, CSI ? KErase display/line; selective erase respects DECSCA
CSI X, CSI @, CSI PErase, insert, and delete characters
CSI L, CSI M, CSI S, CSI TInsert/delete lines, scroll up/down
CSI bRepeat the last printed character (REP)
CSI rSet the scroll region (DECSTBM)
CSI Pl ; Pr sSet the left/right margins (DECSLRM) while mode 69 is set. Text wraps and scrolls inside them, and IL/DL/ICH/DCH/SU/SD stay inside them; scrolling inside narrower margins doesn't add to scrollback
CSI s, CSI u, ESC 7, ESC 8Save/restore cursor and character sets; CSI s is DECSLRM while mode 69 is set
CSI Ps SP qCursor style (DECSCUSR): block, underline, or bar, blinking or steady; 0 restores the configured default shape, steady
CSI Ps " qCharacter protection (DECSCA)
ESC D, ESC E, ESC MIndex, next line, reverse index
ESC =, ESC >Application/normal keypad
ESC ( 0, ESC ) 0, ESC ( B, ESC ) B, SO, SIDEC special graphics in G0/G1; other designations select ASCII
ESC # 8Screen alignment test (DECALN): fills the screen with E, resets the margins, and homes the cursor
CSI ! pSoft reset (DECSTR); screen contents are kept, and mode 69 is reset
ESC cFull reset (RIS)

Not supported

Sixel and iTerm2 (OSC 1337) images, desktop notifications (OSC 9 text, OSC 777, OSC 99), window manipulation beyond the CSI t reports above, and mouse pointer shapes (OSC 22). Use Kitty graphics for images.

On this page