Ubuntu – How to snap a window in a corner with 18.04

gnome-shellmutterwindow

Super + left/right snaps windows to fit half the screen.
I'd like to be able to snap four windows in all corners.
CompizConfig Settings Manager doesn't seem to be an option since 18.04 uses the GNOME desktop.

Best Answer

Tested and works in Ubuntu 18.04 and Ubuntu 20.04:

As you've found out, Ubuntu 18 has moved away from the Unity desktop manager which I had finally gotten used to, to Gnome desktop, which is much different. Compared to Unity, Gnome Desktop's configuration settings are all wacky. You'll need to install Gnome shell extensions.

I recommend using the Put Windows GNOME extension, like @heynnema says.
However, hknust likes the ShellTile one, so you can try it out too.

Note that Gnome Shell extensions change how your desktop works, but you configure them through your browser, which seems kind of weird at first. Your browser, in this particular case and for this particular application, acts as a front-end messaging service to communicate with the back-end configuration settings which apparently are running as a background program on your PC.

How to install the "Put Windows" GNOME shell extension to enable window tiling in Ubuntu 18:

Steps (in part borrowed from hknust's answer):

  1. Enable shell extensions (the back-end service) on your PC, and the Gnome shell extension in Chrome (the front-end configuration panel):

    sudo apt install gnome-shell-extensions chrome-gnome-shell
    
  2. In your Chrome browser, open https://extensions.gnome.org/.

  3. Search for "put windows", as shown below, and click on it. enter image description here

  4. Install it by clicking the button to the far right of it. You may see a message saying you need to install "GNOME Shell integration" from the Chrome Web store. If you do, go here and install that into Chrome: https://chrome.google.com/webstore/detail/gnome-shell-integration/gphhapmejobijbbhgpjhcjognlahblep.

  5. Now you'll get that little foot-icon extension in the top-right of your Chrome: enter image description here. Click it, then click the "Installed extensions" tab at the top of the page that loads. You'll now see the "Put Windows" extension installed as shown here. Note that you may need to refresh the page to get it to show the screwdriver and wrench icon once you've installed it: enter image description here.

  6. Configure it by clicking the little screwdriver and wrench icon under the yellow arrow I made in the image above. Notice the default keyboard shortcuts are set like so: enter image description here Super (ie: Windows key) + Keypad 7, for instance, will tile the selected window to the top-left corner of your screen.

  • If you have an ultrabook or smaller laptop that does not have a Numpad/Keypad, then I recommend using the following settings instead (where the "Super" key is your "Windows" key): enter image description here
  • If you use the laptop/ultrabook settings that I recommend just above, note that the Alt + Super + S keyboard shortcut will interfere with Ubuntu's default Screen Reader keyboard shortcut, which is the same. So, go to Ubuntu's Settings --> Devices --> Keyboard --> click the search icon (magnifying glass) at the top-right side of the window, search for "Alt+Super+S", you'll see the option for "Turn screen reader on or off", which is assigned to this shortcut sequence. Click it, then press the Backspace key to delete this shortcut, then click the green "Set" button that appears. Done! The shortcut for this option now shows "Disabled" in bold instead of "Alt+Super+S" like it used to show. Here's what that looks like: enter image description here
  • Once you've done this, the Put Windows Alt + Super + S keyboard shortcut to center or maximize the window may be temporarily broken, so you need to toggle this extension off and then back on again to refresh and fix it. Go back to Chrome (or whatever internet browser you used to configure this) --> click the black footprint ("Open GNOME Shell extensions website" button: enter image description here) in the top-right of your browser --> Find your "Put Windows" entry as shown here: enter image description here, and click the "ON" slider to toggle this extension off, then click it again to toggle it back on. Now try your Put Windows window snap shortcuts and it should all be working! Alt + Super + S and the other shortcuts should all work fine now.
  • You will now no longer have a conflict between this keyboard shortcut and the Put Windows shortcut to "Move to center/maximize".
  1. Remember, even though it seems odd at first, the browser plugins and tools are simply the front-end GUI interface to configure your computer's GNOME desktop settings. This fact alone can seem confusing at first.

BUG NOTE/WEIRD BEHAVIOR: If you are trying to snap a window to a corner but its size is off, first snap it to the center (Alt + Super + S), then snap it to the corner (ex: Alt + Super + Q to move to upper-left corner), and it will now be the right size to allow 4 windows to be seen at once--one in each corner, as snapping it to the center first also gets it to be the right size--ie: exactly 1/4 of the screen area.

Done!

Related:

  1. Bug fix you might need to restart Gnome in the future in case Put Windows ever quits working: GNOME Shell Extension Put Windows stopped working