I’m currently recording footage for my upcoming Ubuntu 23.04 video and, while doing so, reminded myself that there’s a hidden setting I always use that I don’t think I’ve ever written about on this blog.
Please don’t get excited by my use of the term “hidden”. You’re probably aware that this setting exists, you just might not have known where to find it, hence the “hidden” qualifier.
Whenever I open a new app window it “spawns” in the center of my screen, like so:
I find this behaviour predictable, reliable, and a few other -bles as well. For me, centred windows is really useful when I’m recording screencast content as the ‘center’ of the screen is where viewers are generally looking, and being able to edit knowing where new windows appear makes the process easier.
You can make Ubuntu open new app windows in the center of the screen by making use of a system variable that’s not exposed in the default GUI (though you can get a GUI toggle for it by installing GNOME Tweaks utility).
I find the CLI fastest way to do this as you only need to run one command to “Center New Windows” in Ubuntu (or any other Linux distribution using the GNOME Shell desktop):
- Open a new Terminal window
- Paste
gsettings set org.gnome.mutter center-new-windows true
- Hit the
enter
key
This change will take effect immediately after you press the enter
key. To test it, launch any app on the Ubuntu Dock (that’s not already open) and watch as the window appears in middle of your display.
Simple as that.
Should you want to turn the behaviour off, you can do so easily. Re-run the command above but this time replace true
at the end with false
, and hit enter
to apply. The change takes effect instantly. From that point on, all new windows will spawn somewhere on your display — I’m not sure of the exact default placement heuristic.