I heard that there is no pure, cross-platform solution. But maybe there are three separate solutions for most-used platforms (Linux, Mac, Win), which can be combined to get the needed value in most situations?
This needs to be included into a library, thus I can’t add some sort of a pre-launch scripts to get the width.
I would suggest using JLine – specifically, you can use `Terminal.getTerminalWidth’ to get the terminal width.
JLine Terminal