Terminal fullscreen dimensions

a month ago by christos to c/commandline

A simple question with an easy answer: how many characters long is your terminal in full screen? I am working on a torrent searching script, and I am interested in the statistical max dimensions of a terminal. Thanks in advance.

wizardbeard 2 points a month ago

Looks like by default, when not full screened PowerShell and Windows Terminal default to 120 characters wide. Full screen and terminals embedded in IDEs and the like give me: 187, 209, 236, and 237. That all depends on screen size, dpi settings, font size settings, zoom settings, etc.


Depending on the scripting language and the terminal host, there are usually a handful of ways to get this dynamically at runtime. .Net/PowerShell exposes this as [Console]::WindowWidth for most (but not all) hosts.

There's going to be wide variances in this, so I personally wouldn't target some static value of how wide you expect it to be. In situations where I can't just let the host's word wrap handle long lines or let the scripting language handle it automatically (PowerShell's $ObjectList | Format-Table -Autosize is nice for this), then I just I grab the current window width when I need it.

I have a few "for fun" scripts that do ascii art animations, and they check the terminal's height and width every frame, adjust the "image" as needed, then redraw at the current size.

path: 0 25859478, hotness: undefined, score: 2, children: 1
christos 2 points a month ago

My estimated max is 142 characters, so that all torrent info can be rendered. Thank you for your response.

path: 0 25859478 25859692, hotness: undefined, score: 2, children: 0
dihutenosa 2 points a month ago

430 with the external widescreen, 240 in laptop display.

path: 0 25869269, hotness: undefined, score: 2, children: 0
Kissaki 2 points a month ago

Windows Terminal, default windowed, 160, maximized/fullscreen 280

path: 0 25873971, hotness: undefined, score: 2, children: 0
stembolts 1 point a month ago

Use relative positioning. Question becomes obsolete and UI scales itself. It is a hard problem tho. I was introduced to this via Kotlin Compose philosophy, aka, "parents don't dictate size, children do". If that makes sense.

If you don't do relative sizing, wouldn't your terminal "max-width" scale with resolution?

path: 0 25865175, hotness: undefined, score: 1, children: 1
christos 2 points a month ago

Thx, you are correct. I now think I have resolved the issue.

path: 0 25865175 25869076, hotness: undefined, score: 2, children: 0
commandline
commandline

@programming.dev

login for more options
2242
131
23

go to feed...