On a Linux desktop, often, we spend our time manually rearranging new windows opened at random positions on the screen. To avoid this, we might want to set their placement in the center or another convenient position on the screen to create a more organized workspace.
In this tutorial, we’ll explore different methods for opening a window in the center of the screen in a Ubuntu 22.o4 installation.
Specifically, we use the gsettings command, the dconf Editor, and the GNOME Tweaks tool on a GNOME desktop. Furthermore, we use the Window Manager Tweaks on an Xfce and the System Settings on a KDE Plasma desktop.
2. Using the gsettings Command
gsettings is a command-line tool used to configure and display values in the dconf database. Moreover, we can use it to open a window in the center of the screen of a GNOME desktop.
To do so, let’s run the gsettings command in our terminal:
$ gsettings set org.gnome.mutter center-new-windows true
Here, we set center-new-windows as true to center the newly opened windows on the desktop.
Now, we open any application, such as Rhythmbox on our system to test the configured settings:
As a result, we can see the newly opened window of Rhythmbox in the center of the screen.
3. Using the dconf Editor
The dconf Editor is a graphical tool that enables us to directly edit the entries of the dconf configuration in a GNOME desktop environment.
In this case, we use the dconf Editor to open a new window in the center of the screen.
For this, first, we open a terminal and install dconf Editor on the system via apt:
$ sudo apt install dconf-editor
After a successful installation, we bring up the Activities menu, type dconf Editor, and open the application:
Then, we navigate to the /org/gnome/mutter path and look for the center-new-windows toggle:
Next, we enable the center-new-windows toggle, and click Reload to apply the changes:
Now, we open the Trash directory to test the window placement settings:
Thus, we can see the opened window at the center of the system’s screen with the same option that gsettings enabled.
4. Using the GNOME Tweaks Tool
Along with other methods, we can also use the GNOME Tweaks tool to place a newly opened window at the center of the system’s screen.
However, first, we need to install the GNOME Tweaks tool on our system.
For this, let’s open the terminal and install the gnome-tweaks package with apt:
$ sudo apt install gnome-tweaks
After a successful installation, we open the Activities menu, type Tweaks, and launch it:
Next, we go to the Windows option from the left-side panel and click on the Center New Windows toggle to enable it:
Finally, we now open Nautilus, the default file manager of the GNOME desktop to test out the settings we added:
Consequently, we can see the Nautilus window at the center of our desktop screen.
5. Using the Window Manager Tweaks
In an Xfce desktop environment, we can use the Window Manager Tweaks built-in tool to set the window placement to the center of the screen.
To do so, first, we type Window Manager Tweaks in the Activities menu and open it:
Then, we switch to the Placement tab, and mark the At the center of the screen radio button:
Now, we open any application like the Mines game on our system to test the added settings:
Thus, the changes reflect the placement of the Mines game window on the screen.
6. Using System Settings
On a KDE Plasma desktop, we can use the System Settings to customize different aspects of our system. For instance, we can use it to adjust the behavior of the window placement on the screen.
To do so, we type System Settings in the Activities menu and open it:
Then, we open the Window Management menu and select the Window Behavior item from it:
After that, we switch to the Advanced tab, set the Window placement as Centred, and click Apply:
Now, for testing purposes, we open Sudoku on our system to check its position on the screen:
As a result, we can see the newly opened window of Sudoku in the center of the screen.
In this article, we learned different methods for opening a window in the center of the screen in Linux.
These methods included using the gsettings command, the dconf Editor, and the GNOME Tweaks tool on a GNOME desktop. Further, we explored the Window Manager Tweaks on an Xfce and the System Settings on a KDE Plasma desktop to apply the same window positioning settings.
We saw that all of these methods set the window placement to the center of the system screen. Ultimately, we can select any of them according to the desktop environment in use.