Terminal Guide

Query Keyboard Mapping or Miscellaneous Information

ESC1B P50 +2b q71 [ query ]1+ ESC1B \5C
repeated (one or more times):

Query keyboard mapping or miscellaneous information.

query is a hex encoded string. It can be the encoded form of either a terminfo/termcap key names (e.g. 'kf1') or a string for one of the following additional information:

query pre hex encodingmeaning
colorsquery number of palette colors supported.
Return is either '256', '88' or '16' (after hex decoding)
See 256 colors palette.
RGBReport significant bits for direct color display.
Format is either a number (e.g. '8') or r/g/b (e.g. '5/6/5') where the number or each of r, g, b signifies how many significant bits of the direct color the terminal will be able to reproduce.
If direct color is not supported the result contains '-1'.
See direct color.
namequery name of initial terminal description (e.g. 'xterm')

See use "tcap" keyboard mapping for key names.

The terminal replies with:

ESC1b P50 030 +2b r72 ESC1b \5c 

in case the query was invalid or did not return a result.


ESC1b P50 131 +2b r72 query =3d result ESC1b \5c 

Where query is the original query string (also hex encoded) and result is the result in hex encoding.

If the query parameter is valid but no data is available result and the preceding =3d  are omitted from the reply.

The sequence may contain more than one query, in that case the hex encoded query strings are separated by ;3b  and the replies will contain a part query =3d result  separated by ;3b  for each query the terminal reports a result for.

This page is possibly incomplete. Please report an issue if you see something is missing or you have further information.

xterm ( 🔧 )

🛈 xterm aborts processing with the first query that is not successful, all further query parts are ignored.