From 18e73d0cff13b0e326f009fb7abce66e843b27c4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 24 Nov 2025 09:31:52 +0530 Subject: [PATCH] Make the example script to read screen geometry work on POSIX sh --- docs/graphics-protocol.rst | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/graphics-protocol.rst b/docs/graphics-protocol.rst index 7ba2127d6..c82a8f3f7 100644 --- a/docs/graphics-protocol.rst +++ b/docs/graphics-protocol.rst @@ -132,19 +132,24 @@ code to demonstrate its use } -.. tab:: Bash +.. tab:: POSIX sh .. code-block:: sh - - #!/bin/bash - + #!/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. - builtin read -r rows cols < <(command stty size) - IFS=x builtin read -r width height < <(command kitten icat --print-window-size); builtin unset IFS - builtin echo "number of rows: $rows number of columns: $cols screen width: $width screen height: $height" + read rows cols <