Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:resize_a_window_with_the_wmctrl_command [2009/03/09 13:41]
Joel Dare created
linux:resize_a_window_with_the_wmctrl_command [2020/06/01 22:53] (current)
Line 1: Line 1:
 +====== Resize a Window with the wmctrl Command ======
  
 +I wanted to change the behavior of the maximize button in Gnome. ​ It seems, however, that you cannot change this in the default window manager that Gnome uses.  So, I looked for an alternative.
 +
 +What I found was //​wmctrl//​. ​ This command allows you to select and resize any window (as well as a bunch of other stuff).
 +
 +I used the following command as my //​maximize//​ command.
 +
 +  wmctrl -r :ACTIVE: -e 0,​1300,​45,​1630,​940
 +
 +The //-r// option specifies the window. ​ You can specify the window using several different criteria. ​ I used the special keyword //:​ACTIVE://​ to indicate the currently active window.
 +
 +The //-e// option specifies the position of the new window. ​ The arguments are gravity, x position, y position, width, then height. ​ In my case, gravity is always 0 (the windows own default).  ​
 +
 +As you can see, my //x// argument is set at 1300.  This is because I have two monitors and my primary monitor is to the right of my secondary. ​ As a result, 1300 is about 20 pixels from the left edge of my primary monitor.
 +
 +For a single monitor setup, you might try something like the following.
 +
 +  wmctrl -r :ACTIVE: -e 0,​100,​100,​600,​400
 +
 +Because I couldn'​t find a way to change the actual maximize button, I created a little application launcher on the panel (toolbar) I have across the top of my screen. ​ This works quite well for me.  One gotcha is that it does not remember the size of the window before you maximize, so you can't easily go back to that previous size.
comments powered by Disqus
linux/resize_a_window_with_the_wmctrl_command.txt · Last modified: 2020/06/01 22:53 (external edit)