Skip to main content
ansicode

DECRQM — Request Mode Status (CSI ? Ps $ p)

Ask the terminal whether a specific DEC private mode is enabled — used for feature detection at runtime.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[?Ps$p
\\033[\033[?Ps$p
\\e[\e[?Ps$p
ESC [ESC [ ? Ps $ p
hex1b 5b 3f <Ps> 24 70

Description

Request Mode (DEC variant). The intermediate `$` (0x24) and final `p` (0x70) make this a DECRQM frame for a DEC private mode `Ps`. Reply: `\x1b[?Ps;Pm$y` where `Pm` is 0 (mode not recognised), 1 (set / enabled), 2 (reset / disabled), 3 (permanently set), or 4 (permanently reset). This is the canonical way for an application to ask, at runtime, whether a feature it wants is actually available — `\x1b[?2026$p` for synchronized output, `\x1b[?1004$p` for focus events, `\x1b[?2004$p` for bracketed paste, `\x1b[?1006$p` for SGR mouse encoding. Without DECRQM, apps degrade to optimistic emission + hope. Note: the ANSI-mode variant (no `?`) `\x1b[Ps$p` queries non-DEC modes like KAM, IRM, SRM.

Spec citation: xterm-ctlseqs (DECRQM, CSI ? Ps $ p)

Examples

bash
printf '\033[?2026$p'   # is synchronized-update mode available?
python
import sys; sys.stdout.write('\x1b[?2026$p')
go
fmt.Print("\x1b[?2026$p")
javascript
process.stdout.write('\x1b[?2026$p')
c
printf("\x1b[?2026$p");

Terminal support

xterm
yes
Linux console (fbcon)
partial
macOS Terminal.app
partial
iTerm2
yes
Windows Terminal
yes
cmd.exe / ConPTY
no
kitty
yes
alacritty
yes
WezTerm
yes
Ghostty
yes
GNOME Terminal
yes
Konsole
yes
tmux
no
GNU screen
no

Related sequences

In the family cookbook

CSI cookbook · 4. Queries — DA, DA2, DSR, DECRQM