How to quickly maximize particular window

Around three weeks ago I wrote an article on how to automate mouse and keyboard. It was very fun experience but as the former article was quite long I didn't mentioned about wmctrl tool. It is an excellent complement to the previously described tools.

I will describe only one usage scenario - How to quickly maximize particular window. To check out more examples look at wmctrl user documentation external article.

Using wmctrl you can list windows in easy way:

$ wmctrl -l
0x04600004  0 milosz-notebook Oracle VM VirtualBox Manager
0x040002dc  0 milosz-notebook sleeplessbeastie's notes — WordPress - Google Chrome
0x01800069  0 milosz-notebook Gnuplot (window id : 0)

Maximize particular window:

$ wmctrl -i -r 0x040002dc -b "add,maximized_vert,maximized_horz"

Restore original dimensions of the previously maximized window:

$ wmctrl -i -r 0x040002dc -b "remove,maximized_vert,maximized_horz"

Toggle maximized_vert and maximized_horz properties:

$ wmctrl -i -r 0x040002dc -b "toggle,maximized_vert,maximized_horz"

wmctrl provides more interesting ways to interact with an X Window manager like switching desktops or moving windows between them so I strongly suggest to read its manual page.

Milosz Galazka's Picture

About Milosz Galazka

Milosz is a system administrator working for a successful Polish company and a long time supporter of Free Software Foundation and Debian operating system.

Gdansk, Poland