2

I need my window to be exactly 1280x720 pixels in size, and placed at the offset 1940x20. Is it possible to resize and place an arbitrary window, for example my editor window or browser window, very specifically using the command line?

This is because I want to be able to record tutorials using the ffmpeg command. It's also useful when I take screenshots of a window, and I want the screenshot to be a specific size, say 640x480.


EDIT: @akira brought up a good point I stupidly didn't think about, the window manager. I'm using Awesome WM v3.4.15. I was hoping this could be done at the X level after the window had been opened.

2 Answers 2

5

If you don't want to achieve things via the window manager you might want to try wmctrl:

-r <WIN> -e <MVARG>  Resize and move the window around the desktop.
                     The format of the <MVARG> argument is described
                     below.

<MVARG>      Specifies a change to the position and size
             of the window. The format of the argument is:

             <G>,<X>,<Y>,<W>,<H>

             <G>: Gravity specified as a number. The numbers are
                  defined in the EWMH specification. The value of
                  zero is particularly useful, it means "use the
                  default gravity of the window".
             <X>,<Y>: Coordinates of new position of the window.
             <W>,<H>: New width and height of the window.
1
  • Exactly what I was looking for! Awesome answer
    – Hubro
    Commented Feb 2, 2015 at 13:09
2

This depends on a combination of your window manager and what the app itself provides. Some apps support some for of -geometry WxH+X+Y. Your window manager might overrule the placement of the app.

With fluxbox you can configure a .fluxbox/apps file in which you store several attributes, position and dimension are just a tiny fraction of what you can do. Read more about it: http://fluxbox.org/help/man-fluxbox-apps.php

A different approach is http://www.gusnan.se/devilspie2/ .. it matches (like fluxbox) window properties (names, etc) and apply some rules to it (position, dimension, etc).

1
  • I can configure Awesome to open specific windows at specific positions with specific sizes, but I was looking for a solution that can apply to already opened windows, rather than a semi-permanent configuration change. Also it would be a bonus if the answer wasn't specific to the window manager.
    – Hubro
    Commented Feb 2, 2015 at 12:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .