From 701d229139a729857510201b689676843e79ad7b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Nov 2025 10:52:53 +0530 Subject: [PATCH] Dont depend on icat to read screen size in pixels --- docs/graphics-protocol.rst | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/graphics-protocol.rst b/docs/graphics-protocol.rst index e8a150cf5..f94fe5972 100644 --- a/docs/graphics-protocol.rst +++ b/docs/graphics-protocol.rst @@ -137,20 +137,25 @@ code to demonstrate its use .. code-block:: sh #!/bin/sh - # This uses the kitten standalone binary from kitty to get the pixel sizes - # since we can't do IOCTLs directly. Fortunately, kitten is a static exe - # pre-built for every Unix like OS under the sun. read rows cols </dev/null) + [ "$char" = "t" ] && break + response="${response}${char}" + done + command stty "$oldstty" + h=$(echo "$response" | cut -d';' -f2) + w=$(echo "$response" | cut -d';' -f3) printf "number of rows: %d number of columns: %d" "$rows" "$cols" - printf " screen width: %d screen height: %d\n" "$width" "$height" + printf " screen width: %d screen height: %d\n" "$w" "$h" Note that some terminals return ``0`` for the width and height values. Such