How to maximize a window programmably in X Window?

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*

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You can do this using wmctrl.

Example

Get your window’s ID.

$ wmctrl -l
0x02a00004  0 grinchy <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="92e1f3fffed2f5e0fbfcf1faeb">[email protected]</a>:~
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

Method 2

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


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x