我可以使用命令行精确放置和缩放 X 窗口吗?

Hub*_*bro 3 linux xorg awesome-wm

我需要我的窗口大小正好为 1280x720 像素,并放置在 1940x20 的偏移量处。是否可以非常特别地使用命令行来调整和放置任意窗口的大小,例如我的编辑器窗口或浏览器窗口?

这是因为我希望能够使用该ffmpeg命令录制教程。当我截取窗口的屏幕截图并且我希望屏幕截图具有特定大小(例如 640x480)时,它也很有用。


编辑: @akira 提出了一个我愚蠢地没有想到的好点,窗口管理器。我使用的是 Awesome WM v3.4.15。我希望这可以在窗口打开后在 X 级别完成。

aki*_*ira 5

如果您不想通过窗口管理器实现目标,您可能想尝试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.
Run Code Online (Sandbox Code Playgroud)