Test code from https://sw.kovidgoyal.net/kitty/graphics-protocol/#getting-the-window-size
The following code:
#include <stdio.h>
#include <sys/ioctl.h>
int main(int argc, char **argv) {
struct winsize sz;
ioctl(0, TIOCGWINSZ, &sz);
printf(
"number of rows: %i, number of columns: %i, screen width: %i, screen height: %i\n",
sz.ws_row, sz.ws_col, sz.ws_xpixel, sz.ws_ypixel);
return 0;
}
Produces the following output on Ratty, regardless of the actual window resolution (the terminal rows/columns do vary properly):
number of rows: 31, number of columns: 96, screen width: 0, screen height: 0
Test code from https://sw.kovidgoyal.net/kitty/graphics-protocol/#getting-the-window-size
The following code:
Produces the following output on Ratty, regardless of the actual window resolution (the terminal rows/columns do vary properly):