Ubuntu: Resizing Nautilus window after it has been maximized

ubuntuIf you have issues with the Nautilus default file browser window not being resizable after it has been maximized, first try holding down “alt” while holding down the mouse button and dragging inside the window.

If that does not work, you can use “wmctrl” from the console to fix the issue.

Install wmctrl

$ sudo apt-get install wmctrl -y

Identity the Nautilus window

Use the wmctrl command to list the current windows.

$ wmctrl -l
0x03600008 0 myserver Software Updater
0x02a00002 0 myserver XdndCollectionWindowImp
0x02a00003 0 myserver unity-launcher
0x02a00004 0 myserver unity-panel
0x02a00005 0 myserver unity-dash
0x02a00006 0 myserver Hud
0x0420000a 0 myserver me@myserver: ~
0x0240000a -1 myserver Desktop
0x0240789e 0 myserver Home

In order to target the Nautilus window for resize operations you can use either its identifier (0x….) or a substring of its name.

The name is the name of the directory Nautilus is currently open to, which in my case is “Home” which corresponds to id 0x0240789e.

Remove the maximization

If you target by id:

$ wmctrl -i -r 0x0240789e -b remove,maximized_vert,maximized_horz

If you target by name:

$ wmctrl -r Home -b remove,maximized_vert,maximized_horz

Now the Nautilus window should be non maximized and manually resizable.

Reposition/Resize the window

You must demaximize as shown above first, but after that you can also have wmctrl reposition and resize the window.  The below command resizes the Nautilus window to 800 pixels in width, 600 in height at the position of 25 pixels from the left and 50 pixels from the top.

$ wmctrl -r Home -e 0,25,50,800,600

 

REFERENCES

https://unix.stackexchange.com/questions/53150/how-do-i-resize-the-active-window-to-50-with-wmctrl

https://askubuntu.com/questions/94859/resizing-windows-to-a-particular-width-and-height-instantly

https://askubuntu.com/questions/65457/window-too-big-cant-resize-or-maximize