Score:12

How can I automatically resize a window to 1/4 of the screen and snap it to a corner in Ubuntu 22.04?

cn flag

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

24601 avatar
in flag
The new alternative is `Arrange Windows` in `Extension Manager`
Gabriel Staples avatar
cn flag
@24601, thanks. I just tried it, but it has many limitations: can't change hot keys, can't snap windows to corners.
24601 avatar
in flag
try `Awesome Tiles` in that case
Gabriel Staples avatar
cn flag
@24601, thanks again, but I can't get Awesome Tiles to work at all. Are you able to test on Ubuntu 22.04?
24601 avatar
in flag
I am using 22.04
elukem avatar
mx flag
Awesome Tiles works well for me on 22.04
Gabriel Staples avatar
cn flag
@elukem, I can't get [Awesome Tiles](https://extensions.gnome.org/extension/4702/awesome-tiles/) to work at all for me. I've installed and activated it, but `Super` + `Keypad1` still does nothing for me, for instance, even though that shortcut should resize it to 1/4 of the screen and snap the window to the bottom left.
Gabriel Staples avatar
cn flag
Oh, I see an error at the top of the [Awesome Tiles](https://extensions.gnome.org/extension/4702/awesome-tiles/) webpage: "Your native host connector do not support following APIs: v6. Probably you should upgrade native host connector or install plugins for missing APIs. Refer [documentation](https://wiki.gnome.org/Projects/GnomeShellIntegrationForChrome/Installation) for instructions."
Gabriel Staples avatar
cn flag
@elukem, solved! There were several issues I encountered, but I was able to get `Awesome Tiles` to work perfectly for me as well! Thanks. [See my answer for full details](https://askubuntu.com/a/1446690/327339). "Awesome Tiles" + "WinTile" makes the perfect combo for maximum window management productivity!
Score:8
cn flag

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 - 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)

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

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

If in a hurry, just jump straight down to the "Install WinTile" section below. It's just a few short steps.

As of 3 July 2023 it is now up-to-date with the necessary bug-fixes it was missing for a few years, and you no longer have to install WinTile Reloaded!

The WinTile tool works phenomenally-well in Ubuntu 22.04, with both the X and Wayland window manager servers, and easily snaps windows into corners or edges.

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! Here is an animated gif from the GitHub page: https://github.com/Fmstrat/wintile:

enter image description here

Here is the main WinTile repo: https://github.com/Fmstrat/wintile.

Install WinTile from the Gnome Extension Manager

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

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

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 .

Old 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. https://github.com/Fmstrat/wintile/issues/81
  3. https://github.com/Fmstrat/wintile/issues/91
  4. 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.

Related issues:

  1. https://github.com/Fmstrat/wintile/issues/91
mLstudent33 avatar
ph flag
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.
Gabriel Staples avatar
cn flag
@mLstudent33, what little tool button? Can you screenshot it?
mLstudent33 avatar
ph flag
"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.
Gabriel Staples avatar
cn flag
@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.
Score:1
cn flag

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

Gabriel Staples avatar
cn flag
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](https://askubuntu.com/a/1446690/327339) 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 avatar
cn flag
Oh, I see your edit now. You are using 2 separate keys to direct the window to a corner. Got it!
Gabriel Staples avatar
cn flag
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 avatar
cn flag
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.
Bruni avatar
cn flag
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.
Gabriel Staples avatar
cn flag
I just confirmed that what enables this feature in Ubuntu 22.04 Gnome is my WinTile extension.
Score:1
cn flag

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.

24601 avatar
in flag
maybe gTile perhaps?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.