I'm wondering if there is any commands or programs to make some window maximized in X Window? For example, what I imagine is something like this

xmaximize -window *window_id*

You can do this using wmctrl.


Get your window's ID.

$ wmctrl -l
0x02a00004  0 grinchy saml@grinchy:~
0x0620004f  0 grinchy [gnome] Bash command for Maximizing and Unmaximizing windows in gnome? - Google Chrome

Then toggle window ID 0x0620004f, like so.

$ wmctrl -i -r 0x0620004f -b toggle,maximized_vert,maximized_horz
  • I'll just note that this requires a window manager that supports EWMH/NetWM, which is most likely the case, but something that should be checked if this doesn't work. – casey Dec 4 '13 at 6:23
  • @casey Thanks for this information. Wondering where did you get this such that I can figure out how to check it. – Drake Guan Dec 5 '13 at 1:52

here is a simpler way, just put this code in a script, and set executable with a keyboard shortcut. Works for me.

wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz 
  • Can this be automatised for specific applications? – orschiro Oct 19 '16 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.