I try to get in a bash script the maximal size of a window (i.e. the size of the screen minus the panels on the edges of the screen). I am using Kubuntu but if it could work for any linux system it would be great.
Currently, my solution is to maximize the active window via wmctrl :
wmctrl -r :ACTIVE: -b add,maximized_horz,maximized_vert
and then get the size of the window thanks to xwininfo :
xwininfo -id $(xdotool getactivewindow)
Unfortunately, I don't get the size of the window but the size of the window and it's border (if I remove the border, I get the expected value).
So my questions are :
1 - Is there a command to remove the border of a window ? (I only know how to do it manually)
2 - Is there a better way to do this ? (if it can be done without maximizing a window it could be great)
Thanks in advance for your help
I realised that what I was calling border was in fact the title bar... If I use
xwininfo -stats
I indeed get the border width (0 in my case). The title bar height (after maximizing the window) is obtained in the field Absolute upper-left. The following gives me the expected height :Thanks for your help !