Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get accurate window information in Linux? I know that I can use wmctrl to get a window's size, but the actual size of the window can vary due to window decorations. I need the following information and methods:

* precise window dimensions
* precise available screen space (excluding panels like gnome-panel)
* the ability to set a window to be a certain size, including decorations

What would be the best way to do this?

Thanks in advance!

share|improve this question
If you are interested more in the python side, we can migrate this to our sister site about programming, Just let us know. – Gnoupi Jul 15 '10 at 15:47
@Gnoupi: thanks, but this is actually a cross-post from SO, as a user suggested I might get a better answer here. The original question is at…. – mellort Jul 15 '10 at 15:49
ok, I see. In this case, I think the python part of your question can be edited away. Answers on SU will most likely be using other commands, not programming. The question on SO should probably focus on asking how to do it in python. – Gnoupi Jul 15 '10 at 15:54
@Gnoupi: done. Thanks for the help. – mellort Jul 15 '10 at 15:59
Get window dimension with decorations:… – Ciro Santilli 巴拿馬文件 六四事件 法轮功 Aug 13 '14 at 6:48

There are some programs on the linux-console, that might help.

  • xwininfo: It gets you the size of the window excluding the decoration and the position absolute (to the screen) and relative (to the area for windows)
  • xdpyinfo: This gives far more information about your screen-device, than you ever want to know about. But it has somewhere in the output something like screen: #0 followed by dimension: 1024x768.
share|improve this answer
Is there a way to get information including the decoration? – Victor Mar 27 '12 at 23:49

> precise window dimensions

The following example (will work at least in sh, bash and zsh) will print window geometry with and without frame for all windows with "KWrite" somewhere in title.

windows="$(wmiface findNormalWindows "KWrite" "" "" "" "" "")"
for window in $(echo $windows); do
  echo $window
  wmiface framePosition $window
  wmiface frameSize $window
  wmiface windowPosition $window
  wmiface windowSize $window
} done

> precise available screen space (excluding panels like gnome-panel)


For example:

xrandr | head -n1 | cut -d, -f2 | cut -d" " -f3-5

Output in my case:

4400 x 2560

Not sure how to exclude panels - if you have more than one monitor, they can be even in middle of virtual screen, so screen geometry without panels can be more complicated than "available screen space".

> the ability to set a window to be a certain size, including decorations

wmiface setFrameGeometry $window $x $y $width $height

Read wmiface README for even more possible commands.

share|improve this answer
wmiface is not packaged with all (any?) distros. I was able to install on Mint by using the ubuntu package from here: The README mentioned can be found here:… – slinkp Sep 18 '14 at 14:20
See the second part of this comment for another way to get full geometry including decorations using a combination of xwininfo, xdotool, and xprop. – slinkp Jan 27 at 4:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.