"I'm currently working on a Go application using the tview library for building terminal-based user interfaces. I need to retrieve the screen size (width and height) to properly configure my application layout. However, I couldn't find a direct function in the tview library to get the screen size.
Can anyone provide guidance on how to obtain the screen size when using tview? If there's no direct function in tview, is there a recommended way to achieve this using the underlying tcell package or any other approach?"
I attempted to find a direct function within the tview library to retrieve the screen size, but I couldn't locate one. Following that, I explored the tcell package, which is the underlying terminal handling library used by tview, but I encountered difficulties in obtaining the screen size using tcell.Screen.Size().
My expectation was to find a straightforward way to retrieve the screen width and height, either through tview or tcell, to properly configure the layout of my Go application. However, I'm currently uncertain about the correct approach and would appreciate guidance on how to achieve this.
Assuming you are using a linux based system:
package main
That does work and if you resize the window you will get different results. I tried this on a windows system and seems to also work but I can't resize my window to verify that.