How to Center Application Windows in Ubuntu

One of the key features of a good user interface is the ability to easily center application windows on the screen. This allows for better organization and makes it easier to focus on the task at hand. In Ubuntu, a popular Linux-based operating system, there are a few different methods you can use to center application windows. In this article, we will explore these methods and show you how to center application windows in Ubuntu.

Method 1: Using keyboard shortcuts

One of the quickest and easiest ways to center application windows in Ubuntu is by using keyboard shortcuts. Here’s how you can do it:

  1. Open the application window you want to center.

  2. Press the “Super” key (also known as the Windows key) and the “Up” arrow key at the same time. This will maximize the window and center it on the screen.

  3. If you want to center a window that is not currently maximized, you can first press the “Super” key and the “Left” or “Right” arrow key to dock the window to one side of the screen. Then, press the “Super” key and the “Up” arrow key to center it.

Method 2: Using a window placement tool

If you prefer a more automated approach to centering application windows in Ubuntu, you can use a window placement tool such as “gTile.” This tool allows you to easily snap windows to predefined positions on the screen, including the center.

Here’s how you can use gTile to center application windows in Ubuntu:

  1. Install gTile from the Ubuntu Software Center or by using the following command in the terminal:
sudo apt install gnome-shell-extension-gtile
  1. Once installed, open the “Extensions” app from the Ubuntu Activities menu.

  2. Find gTile in the list of extensions and enable it.

  3. Open the application window you want to center and press the “Super” key and the “S” key at the same time. This will open the gTile menu.

  4. Select the “Center” option from the menu to center the application window on the screen.

Method 3: Using the terminal

If you prefer to use the terminal to center application windows in Ubuntu, you can do so by using a tool called “wmctrl.”

Here’s how you can use wmctrl to center application windows in Ubuntu:

  1. Install wmctrl by using the following command in the terminal:
sudo apt install wmctrl
  1. Open the application window you want to center.

  2. Use the following command in the terminal to center the window:
wmctrl -r <window_title> -e 0,(( $(xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -d 'x' -f 1) - $(xdotool getwindowfocus getwindowgeometry --shell | grep Width | cut -d '=' -f 2 ) ) / 2 ),(( $(xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -d 'x' -f 2 ) - $(xdotool getwindowfocus getwindowgeometry --shell | grep Height | cut -d '=' -f 2 ) ) / 2 )

Replace with the title of the application window you want to center.

By following these methods, you can easily center application windows in Ubuntu and improve your workflow. Whether you prefer using keyboard shortcuts, window placement tools, or the terminal, there are options available to suit your preferences. Try out these methods and find the one that works best for you!