14

I wrote this popular answer for Ubuntu 18.04 and 20.04, but now it won't work on Ubuntu 22.04 due to Wayland.

https://github.com/negesti/gnome-shell-extensions-negesti#wayland--wnck:

Because of this dependency and the different concepts of wayland and X11 to identify applications (wm_class vs. application_id) Wayland is not supported!

And from https://extensions.gnome.org/extension/39/put-windows/:

enter image description here

Any ideas, fixes, or alternatives?

This is something but isn't very useful, in my 2 minutes of playing with it: https://help.ubuntu.com/stable/ubuntu-help/shell-windows-states.html.en

In case this matters, a fresh Ubuntu 22.04 install has GNOME Shell 42.5, as shown by gnome-shell --version.

WinTile looks promising, but no luck so far. I opened an issue: https://github.com/Fmstrat/wintile/issues/91#issue-1504090370

3 Answers3

11

I have discovered how to install and use two really good Gnome extensions for this:

  1. Awesome Tiles

    Allows window snapping via shortcut keys, just like "Compiz" in Unity in Ubuntu 14.04 and 16.04, and "Put Windows" in Gnome in Ubuntu 18.04 and 20.04.

  2. WinTile (generally newer and more feature-rich, but may be buggier and less-usable) and WinTile Reloaded (a dead WinTile fork with various bug fixes, but more-usable and what I generally use)

    Allows resizing, tiling, and snapping windows just by dragging them to the edges or corners of a screen--same as in modern versions of Windows apparently. Very useful and fast for mouse users. Tested and works in Ubuntu 18.04, 20.04, and 22.04.

    WinTile also adds to Ubuntu's Gnome window manager the shortcut sequence described in @Bruni's answer for Kubuntu, which Ubuntu doesn't otherwise have, namely:

    To snap to the top-left corner, for instance: Super + left Arrow and then Super + upper Arrow

I like to use both of the above extensions simultaneously. I've tested both of them in Ubuntu 22.04 with both the X11 and Wayland window manager servers, and both extensions work in both cases.

Extension 1: Awesome Tiles (uses keyboard shortcuts to resize and snap windows to edges and corners)

Tested in Ubuntu 22.04 with both the X11 and Wayland window manager servers.

Due to a known bug in Ubuntu 22.04, you can not install "Awesome Tiles" from the browser here: https://extensions.gnome.org/. Instead, install it from the gnome-shell-extension-manager:

# install it
sudo apt update
sudo apt install gnome-shell-extension-manager

Open its GUI by pressing the Windows key and typing "Extension Manager". Its icon is a blue puzzle piece:

enter image description here

Click the "Browse" tab at the top, then search for "awesome tiles". Click the "Install" button to install it. Here you can see mine is already "Installed":

enter image description here

Click the "Installed" tab at the top, ensure the slider shows "Awesome Tiles" as activated (click the slider to activate/deactivate it), then click the gear icon to modify its settings:

enter image description here

Here are the default settings and shortcut keys it uses:

enter image description here

As you can see, it uses the Super (Windows) key + the keypad keys. A lot of smaller laptops and keyboards, however, do not have the keypad on the right side of the keyboard, so I recommend you use the Alt + Windows + Letters shortcuts which I've used in "Put Windows" before. Also, I really hate the gaps all around the windows (like a lot--so much so that I woulnd't recommend this tool at all if I couldn't remove them), so I recommend you remove the gaps by changing "Gap Between Window and Workspace" to 0, and disabling "Gaps Between Windows".

But, before we can add all of the shortcuts I like, we have to disable the default Ubuntu Alt + Windows + S "screen reader on or off" shortcut, which interferes. Go to your Ubuntu Settings --> Keyboard --> click "View and Customize Shortcuts" --> type in "alt+super+s", as shown here:

enter image description here

Click the "Turn screen reader on or off" shortcut you can see which is currently assigned to Alt+Super+S, and press Backspace to disable the shortcut --> click the "Set" button. You can now see it is "Disabled". Perfect:

enter image description here

Now go ahead and change your "Awesome Tiles" keyboard shortcuts to be as follows. Remember that the Super key is the Windows key on a PC. Here are my new settings. I have highlighted all of the ones I just changed:

enter image description here

Update: I just changed this too: I changed 0.35 -> 0.33, and I added 0.25:
enter image description here

If you ever want to reset all of the settings to their defaults, see my answer here: How do I reset a Gnome Extension's settings to default? Ex: for "Awesome Tiles" in Ubuntu 22.04?.

Two other settings you may want to mess with are the "Center Tiling Steps" and "Side Tiling Steps". If you press the same shortcut repeatedly, it cycles through those multiple size settings as set there. Those are values from 0 to 1, where 0 represents 0% of the full size for that position, and 1 represents the full size for that position, So, press the same shortcut repeatedly to cycle through 3 (as currently set) different sizes for each one, sized according to those settings.

To get the most consistent results, I like to tile the window to center first. So, if I wanted to resize and snap the window to the top-left corner, I would press first Alt + Windows + S to center the window, and then I'd press Alt + Windows + Q to resize and snap it to the top-left. Centering between each move ensures it's always the correct size for that new position.

That's it! This is an excellent extension to use keyboard shortcuts to resize and snap your windows to edges and corners!

Extension 2: WinTile (allows you to drag with the mouse your windows to resize and snap them to left, right, or corners)

Tested in Ubuntu 22.04 with both the X11 and Wayland window manager servers, and in Ubuntu 18.04 and 20.04 with X11. It works phenomenally-well in Ubuntu 22.04, with both the X and Wayland window manager servers, and easily snaps windows into corners or edges.

Note: WinTile also adds the ability to snap to corners with the keyboard using Super + left Arrow and then Super + upper Arrow, for instance.

Here is an animated gif from the GitHub page: https://github.com/Fmstrat/wintile:

enter image description here

Here are the repos:

  1. WinTile: https://github.com/Fmstrat/wintile
  2. WinTile Reloaded: https://github.com/ElectricRCAircraftGuy/wintile-reloaded

Option 2.1: WinTile Reloaded (what I recommend you try first; is generally less buggy; is forked off of WinTile)

Note: to see my previous "WinTile Reloaded" installation instructions instead, see an earlier version of this answer here: https://askubuntu.com/revisions/1446690/19.

Install it

We will use my repo fork at https://github.com/ElectricRCAircraftGuy/wintile-reloaded. Here's how to install it:

Open a terminal with Ctrl + Alt + T and run the following commands, one-at-a-time:

cd ~/.local/share/gnome-shell/extensions
# clone the tool
git clone https://github.com/ElectricRCAircraftGuy/wintile-reloaded.git
# rename it
mv wintile-reloaded wintile-reloaded@jaajeur.xyz

log out of Ubuntu

gnome-session-quit

Enable and configure it

After logging out of Ubuntu and logging back in, press your Windows key and search for "Extension Manager". As of Ubuntu 22.04, it's a blue puzzle piece, as previously shown above. Click it. Click the slider to activate "WinTile RELOADED". Click the gear icon and set your settings like this:

enter image description here

That's it! Drag windows to the corners or edges of your monitor to your heart's content.

Note that there are two ways to change the settings:

  1. Option 1: via the browser:
    1. Go here: https://extensions.gnome.org/local/.
    2. Under the "Installed Extensions" heading, look for "WinTile RELOADED".
    3. Click the little tool (blue screwdriver and wrench) icon.
  2. Option 2 [my preference]: via the gnome-shell-extension-manager GUI that you should have installed as part of the "Extension 1" instructions above.
    1. Press your Super (Windows) key, and type in "extensions". Open the "Extensions" tool.
    2. Find "WinTile RELOADED" and click the round settings button.

In both cases, the above settings window is opened. Here are the possible settings to tweak. I decreased my Delay in ms before preview displays setting from the default 500 ms to 100 ms to make it much snappier, and I decreased my Number of columns setting from 3 to 2.

Final thoughts

I love this tool and use it extensively!

Overall, it's not quite as versatile as "Put Windows" or "Awesome Tiles", but WinTile works great in Ubuntu 22.04, with both Wayland and X window servers, and it's more-intuitive for Windows users and those who like to use trackpads or mice .

It takes some getting used-to compared to the tools I've been using for the past 8 years: CompizConfig in Unity in Ubuntu 14.04 and 16.04 and the "Put Windows" tool in GNOME in Ubuntu 18.04 and 20.04, but overall it gives a more-natural experience if you're using a mouse. Just drag the window towards the monitor edge or towards the corner and it automatically resizes and snaps accordingly!

Option 2.2: WinTile (has more features and commits; is more actively maintained)

Install WinTile from the Gnome Extension Manager

Press your Windows key and search for "Extension Manager". As of Ubuntu 22.04, it's a blue puzzle piece, as previously shown above. Click it. Click the "Browse" tab at the top, then search for "wintile". Click the "Install" button to install it. Here you can see mine is already "Installed":

enter image description here

Click the "Installed" tab at the top, ensure the slider shows "WinTile" as activated (click the slider to activate/deactivate it). If you have previously installed WinTile Reloaded and it is still active, disable it by clicking its slider to turn it off. Here's what I see:

enter image description here

Click the gear icon next to it now to configure settings.

Two other ways to enable/disable Gnome Extensions: 1) from your browser, 2) from the command line

  1. You can also activate extensions from the webpage if desired. Run this so that Chrome can be used to configure your local Gnome extensions:

    sudo apt install chrome-gnome-shell
    

    Now, open your Gnome Extension web-page in Chrome, as a portal into your locally-running Gnome extensions server: https://extensions.gnome.org/local/

    You'll now see "WinTile" as an option! (note: this is an old image showing "WinTile RELOADED" instead):

    enter image description here

    To activate it, you can either click the toggle button from "OFF" to "ON" in that extension webpage (you must do it in this way in Ubuntu 18.04, and you can do it this way in Ubuntu 20.04 or 22.04).

  2. A 3rd way to activate the extension is via the terminal:

    # enable it as a Gnome Extension (this cmd works in Ubuntu 20.04 and 22.04,
    # but not in 18.04; for 18.04 you must manually click to enable the 
    # extension, as described just above)
    gnome-extensions enable wintile@nowsci.com
    

    disable the no-longer-needed WinTile Reloaded

    gnome-extensions disable wintile-reloaded@jaajeur.xyz

    See a list of all gnome-shell extensions you can enable/disable like this

    ls -1 ~/.local/share/gnome-shell/extensions/ | grep '@'

    If you run the terminal command, you'll see the toggle update live in the browser window.

That's it! Drag windows to the corners of your monitor to your heart's content.

WinTile Configuration options

There are two ways to change the settings:

  1. Option 1: via the browser:
    1. Go here: https://extensions.gnome.org/local/
    2. Under the "Installed Extensions" heading, look for "WinTile RELOADED" "WinTile": enter image description here
    3. Click the little tool (blue screwdriver and wrench) icon: enter image description here
  2. Option 2 [my preference]: via the gnome-shell-extension-manager GUI that you should have installed as part of the "Extension 1" instructions above.
    1. Press your Super (Windows) key, and type in "extensions". Open the "Extensions" tool: enter image description here
    2. Find "WinTile RELOADED" and click the round settings button, circled here: enter image description here

In both cases, the below settings window is opened. Here are the possible settings to tweak. I decreased my "Delay in ms before preview displays" setting from the default 500ms to 100ms to make it much snappier, and I decreased my "Number of columns" setting from 3 to 2.

enter image description here

WinTile issues, and WinTile Reloaded references:

  1. To see my old "WinTile Reloaded" installation instructions, see this older version of this answer here: https://askubuntu.com/revisions/1446690/19
  2. All my issues: https://github.com/Fmstrat/wintile/issues?q=is%3Aissue+author%3AElectricRCAircraftGuy+
  3. https://github.com/Fmstrat/wintile/issues/81
  4. https://github.com/Fmstrat/wintile/issues/91
  5. https://github.com/Fmstrat/wintile/issues/168
  6. https://github.com/Fmstrat/wintile/pull/82
    1. ***** https://github.com/Fmstrat/wintile/pull/82#issuecomment-1236829893
    2. My comment: https://github.com/Fmstrat/wintile/pull/82#issuecomment-1358954979

Graphics driver problems in Ubuntu 22.04?

This is kind of related if you just installed Ubuntu 22.04.

If you find your new 22.04 computer having graphics driver problems or freezing, and you have an NVIDIA graphics card, see my detailed answer here to update your graphics drivers. See: (Recommended) Option 2: download and install the driver straight from NVIDIA.

See also my personal website article: Common ways to fix video driver (and related) issues in Linux Ubuntu.

Problems with the Wayland window manager on your new Dell laptop?

  1. See my answer here: Wayland window manager causes my computer to stay on a black/blank screen and not wake up.
  2. See also my personal website article: Common ways to fix video driver (and related) issues in Linux Ubuntu.
  • It worked but I can' figure out what the little tool button in the browser is on Ubuntu 18.04 so I can tune it, Firefox or Chrome. Right now I can only snap it quarter or full screen. I'm also on a VM Virtualbox with dual screen enabled. – mLstudent33 May 03 '23 at 05:43
  • @mLstudent33, what little tool button? Can you screenshot it? – Gabriel Staples May 03 '23 at 05:50
  • "If you click the little tool icon in the browser you can change some settings if you like. Here are the possible settings to tweak. I decreased my "Delay in ms before preview displays"..." I don't know what to screenshot because I don't know what you're referring to. – mLstudent33 May 03 '23 at 06:28
  • @mLstudent33, I see what you mean now. I updated my instructions just now to hopefully make this part much more clear. See my updates in the "Configuration options" section of my answer now. – Gabriel Staples May 03 '23 at 17:49
  • 1
    @GabrielStaples Hi Gabriel, creator of WinTile here. The user (GrylledCheez) who created Reloaded is now an official maintainer at the official WinTile repo, and we have a process for versioning including releases to the GNOME Extension site. Just some info for if you have any desire to update this answer. Thanks! – Fmstrat Oct 10 '23 at 14:59
  • @Fmstrat, thanks for the info. and thank you and GrylledCheez both for maintaining the great tool! I reference and update this answer whenever I do a new Linux Ubuntu LTS OS install, so if you keep your tool working with the various LTS releases of Ubuntu, I'll keep this answer updated as I go, updating it at least every few years, and trying to use your latest version whenever possible. Also, feel free to add an answer to this question yourself which focuses just on WinTile if you like. Claim it as your tool, and you can keep us updated on its features and install process. – Gabriel Staples Oct 10 '23 at 16:10
  • I am currently running WinTile Reloaded on all of my Ubuntu 20.04 and 22.04 systems, because it has maintained a higher level of usability throughout this entire time, has had fewer bugs, fewer install issues, zero regressions, and less time lost. I have updated to WinTile many times, but each time switched back to WinTile Reloaded. WinTile may be fixed now, but the next time I try WinTile again will be either when I install Ubuntu 22.04 on another system, or when I upgrade to Ubuntu 24.04. I'm sure I'll switch entirely to it. – Gabriel Staples Oct 10 '23 at 16:19
3

In case anybody stumbled upon this and wants to do the same on Kubuntu:

To snap to the top-left corner, for instance: Super + left Arrow and then Super + upper Arrow

Bruni
  • 10,542
  • Which corner does this snap a Window to? My goal is to snap to, at a minimum, top-right corner, top-left, bottom-right, bottom-left. The solutions in my answer have way more snapping options than just those 4 corners though. There are something like 24 snapping positions using the solutions in my answer. – Gabriel Staples Apr 21 '23 at 07:24
  • 1
    Oh, I see your edit now. You are using 2 separate keys to direct the window to a corner. Got it! – Gabriel Staples Apr 21 '23 at 07:25
  • 1
    Upvoted. I just realized this works on Ubuntu 20.04 and 22.04 too. I never knew. :) I still like my other tools though in addition to this. This isn't a complete replacement of the other tools I wrote about. – Gabriel Staples May 24 '23 at 04:56
  • Update: I just installed Ubuntu 22.04.2 on a new machine yesterday, and it does not work automatically. It's possible that this (Super + Arrow Keys) working on Ubuntu is a side effect of me having already installed Awesome Tiles and WinTile on those other machines. I don't know. – Gabriel Staples Jun 01 '23 at 20:20
  • 1
    Well, my answer was for Kubuntu. And there it works automatically on 22.04 (and if I remember correctly even earlier). On gnome it is indeed better to use the extensions you suggested. – Bruni Jun 06 '23 at 07:32
  • I just confirmed that what enables this feature in Ubuntu 22.04 Gnome is my WinTile extension. – Gabriel Staples Jun 07 '23 at 18:42
2

The way I do it takes two shortcut keys, Ctrl+Super+Left/Right to throw the window to the left or right, then Ctrl+Super+Up/Down to throw it to the corner. That is:hold

This is: hold Ctrl+Super, then hit the arrow keys.

gsettings set org.gnome.desktop.wm.keybindings move-to-side-e "['<Control><Super>Right']"
gsettings set org.gnome.desktop.wm.keybindings move-to-side-n "['<Control><Super>Up']"
gsettings set org.gnome.desktop.wm.keybindings move-to-side-s "['<Control><Super>Down']"
gsettings set org.gnome.desktop.wm.keybindings move-to-side-w "['<Control><Super>Left']"

As an added bonus, I have Ctrl+Super+Left/Right to center the window:

gsettings set org.gnome.desktop.wm.keybindings move-to-center "['<Control><Super>c']"

This answers what you literally are asking here (i.e., place a window in a corner), but it does not resize a window to fit e.g. a quarter of a screen, which may be what you intended to ask. For tiling, there are still a couple of extensions available, even if the one you listed is not anymore updated. Look for "tile" on the Gnome Extensions website to find and try them.

To reset to default, change set by reset and leave out the last argument of the command.

vanadium
  • 88,010