20

For some reason, I wish to resize a window to a very large size, 4-5 times larger than my screen size. For now, I am doing it manually by moving the entire window but one corner out of the screen and then pulling the corner to expand the window. However, this is very time taking. Is there some way to resize the window to a particular height and width instantly ? (perhaps from commandline or with the help of some small app or something else)

1 Answers1

38

I propose two solutions

wmctrl

Install the wmctrl package, then you can resize your window with

wmctrl -r string -e 0,left,up,width,height

where string is a substring of the window's title, (left,up) are the desired screen coordinates of the upper left window's corner, and (width,height) are the desired window's dimensions.

For a more precise window's choice, run wmctrl -l, which will give you a list of records containing window's ID, screen's number and window's title. Then you can resize a particular window by ID with

wmctrl -i -r ID -e 0,left,up,width,height

More information in wmctrl man page.

devilspie

Install the package devilspie, then create the folder ~/.devilspie and a file my-name.ds in this folder, with content:

(if (is (window_name) "My Window") (geometry "widthxheight+left+up"))

then execute devilspie to resize your window.

Don Hatch
  • 103
enzotib
  • 93,831
  • Thank you! I slight problem - if I resize the window to a large size, the window manager (i think compiz) gets killed and another window manager with very basic windowing capabilities comes in. Any way to avoid this? – Pushpak Dagade Jan 12 '12 at 14:25
  • From wmctrl man page: "wmctrl is a command that can be used to interact with an X Window manager that is compatible with the EWMH/NetWM specification." Probably compiz is not fully compatible or has some bugs, and I cannot help with that. – enzotib Jan 12 '12 at 14:31
  • @Guanidene: I proposed an alternative solution. – enzotib Jan 12 '12 at 14:56
  • You may also want to use -r :ACTIVE to get the current focused window. I added this to a shortcut to move my windows to the right position instantly, whichever ones I had focus on. – AlwaysTalkingAboutMyDog Jun 29 '16 at 02:26
  • 1
    A minor correction to the previous comment: it is -r :ACTIVE: (an additional colon is needed at the end). – Zoltan Apr 08 '17 at 21:24
  • You can use wmctrl -l to get a list of values to pass -r. Window title with spaces can be put in double-quotes. – David Baucum Jul 17 '18 at 20:43
  • One big advantage of wmctrl over some other tools that it allows setting a window size bigger than the physical screen. e.g. wmctrl -r 'TITLE' -e 0,-2176,-3496,8192,8192 to resize to a window to 8192×8192 and center it on a (physical) 3840×1200 screen. – Alex Hajnal Feb 03 '22 at 06:20