Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the actual geometry of a gnome-terminal

in X I know you can get the geometry of a window with xwininfo.

Unfortunately, if i retrieve such geometry from a gnome-terminal and use that to start another one with gnome-terminal --geometry ..., the two windows' top and left don't match.

Indeed, the new terminal is south-east shifted by the width and height of the old terminal's window decoration.

How can I start a new terminal that completely overlaps a first one?

like image 343
etuardu Avatar asked Feb 03 '11 23:02

etuardu


1 Answers

I can propose you a workaround for this problem which is working for me. First of all you obtain the geometry of the window with the following command:

xwininfo -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')

You will get something like this:

  Absolute upper-left X:  783
  Absolute upper-left Y:  344
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 722
  Height: 434
  Depth: 32
  Visual: 0x76
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x4400005 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +783+344  -175+344  -175-272  +783-272
  -geometry 80x24+775+315

Neither the information in the -geometry 80x24+775+315 section nor the information in Absolute upper-left X: 783 and Absolute upper-left Y: 344 allows you to launch a gnome-terminal in the same position than the current on. You have to mix both data to get the appropriate information.

gnome-terminal --geometry=80x24+783+315

Note: I have check this under Ubuntu 11.10 | Unity

like image 95
Alberto Avatar answered Sep 23 '22 00:09

Alberto