1

It was last century, I do not remember what we used at the department, some basic X-server running XWindow, or Motif, and while resizing a window, we would see a small widget centred in the window, telling us the current values for position and size of the altered window. How do we do that, nowadays, with Gnome3 in particular.

I know I can do that after resizing, using xwininfo, but I would like to see it dynamically.

Or is there a command line tool I can invoke, and set the window size of the target window? Something like xkill, but which wouldn't kill the client, just resize it.

4

That window geometry info was usually provided by the window manager. Some apps still do it on their own, notably some terminal apps that report the width and height in characters during a resize -- which is far more useful than reporting in pixels for that kind of program. xfce4-terminal does this.

I don't know how well the following commands will play with Gnome 3, and I don't have Gnome 3 handy to try them, but they might work.

In a traditional X environment you can use xev -id <window> to monitor X events on the specified window. Those events include ConfigureNotify events that report, among other things, the window's position, width, and height. To show only the interesting geometry-changing events use xev -id <window> -event structure. You'll have to use something like xwininfo to discover the window ID to give to xev

To resize and/or move a window from the command line, use wmctrl. The -e option to wmctrl takes an optarg of the form <gravity>,<posx>,<posy>,<width>,<height> with certain values reserved to mean "do not change". To change a window's width and height while keeping its gravity and position unchanged specify 0,-1,-1,<width>,<height>. The easiest way to choose the target window for wmctrl is to use the -r :SELECT: option, but if you happen to know the window ID in advance then you can give that to -r, typically with an additional flag like -i to specify that the ID should be understood as a numeric ID.

Obviously man xev and man wmctrl have all the gory details.

  • Solid answer. If I could recommend one thing it would be to provide some links (static wikis of course) to the man pages that you reference. Other than that, props to you and enjoy the upvote. – bgregs May 13 at 2:12
  • while I had thought of checking xev, I'm very happy you mention wmctrl, which I did not know. – mariotomo May 13 at 17:46
  • @mariotomo, xdotool can also resize windows (and other fancy things) – Stéphane Chazelas May 14 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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