1

I would like to get the height of the window title bar, for example of my browser or nautilus in pixel.

I am referring to the "dark part" in the screenshot, so the strip that holds the min,max,close buttons.

Where is this info stored and can I grep for it?

enter image description here

DK Bose
  • 42,548
  • 23
  • 127
  • 221
kerner1000
  • 4,230

1 Answers1

2

From What causes the deviation in the wmctrl window move command:

$ xprop | grep FRAME
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 28, 0

Whenever you get a windows position and move it to that same position it shouldn't move on the screen but it does due to the height of the title bar. So in my case I would need to subtract 28 from the y-coordinate and move to that spot.


Improving performance

You will find the command takes about 10 seconds to run:

$ time xprop | grep FRAME
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 28, 0

real 0m9.989s user 0m0.017s sys 0m0.004s

This is extraordinary slow. To speed up the search pass a Window ID:

$ time xprop -id $(xdotool getactivewindow) | grep FRAME
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 28, 0

real 0m0.012s user 0m0.011s sys 0m0.003s

Now it's only a hundredth of a second, faster than a blinking eye.