term.has_graphics

term

has_graphics(read1) -> supported

Check whether the terminal shows Kitty graphics protocol images

Sends a graphics query, a 1x1 image under a=q that the terminal checks and does not keep, with a Primary Device Attributes request (CSI c) behind it. Reads to the end of DA1's answer, so no byte of either answer reaches get(). Answers true when the query answered OK. A terminal without the protocol answers an error or nothing, and DA1 then comes alone. Five empty reads in a row, about half a second, count as no answer.

The query carries an image id and no q key: a terminal answers nothing to a command with no id, and q silences the answer.

Must be called in raw mode: outside it the probe writes nothing and answers false, unless a custom read1 is supplied. The first answer is cached, and later calls return it without asking again.