The Linux Desktop Explained With An Intro to Tiling Window Managers
All you need to know about Xorg on Linux and Tiling window managers
There are many things you will wonder when you see a screenshot of a Linux power user’s desktop. How did they do this ?
Their systems are very much customized to the extent that no one can use it except them.
There are even some people who build and use their own applications on their systems; not to talk of custom scripts, icons, fonts and what have yous.
But, the beauty is that in Linux, it is easy to become a power user because everything is customizable. So you can become one too. If you are not already on Linux, I’ll advise you join the party.
Just last 2 weeks, I decided to leave my Microsoft Windows platform and go back to good old Linux once more. But this time, I wanted to try tiling window managers.
What is a tiling window manager you say?
Well, for the average Linux desktop, there is
- A display server
- A display manager
- A desktop environment, and
- A window manager
which are all running in the background. All those components make-up the average Linux desktop.
So, in this story let’s see how they work together and get introduced to tiling window managers in Linux.
The X Protocol and Xorg Server
Xorg
is usually the display server of choice on many Linux systems.
Xorg
is a display server that implements the X protocol
. The X protocol is just a set of rules for communication between the display server and its clients.
Originally, the X protocol and Xorg were designed for server use. This is because Linux was also originally for server-side implementations only.
Xorg was designed to be used to render graphics from a server to a client on another computer. This was to make server’s administration easier. Xorg still works for that purpose.
When Xorg is started, it listens for events like starting applications, mouse clicks and key presses etc. and dispatches those events to the appropriate applications. Then it draws graphics to the screen through a sub application called a compositor
.
A compositor
runs on top of the display server and creates a buffer for each workspace and then composites the buffers to enable visual effects like shadows, transparency, fading, scaling etc… and the display of graphics to the screen.
Display Managers
A login manager
or display manager
runs on top of the display server
and provides an automatically started login interface
for user login when the computer is started.
It then initiates the display manager after the login is successful to show the computer screen to the user.
There are different variants of display managers:
- sddm for Kde desktop
- gdm for the Gnome desktop
- lightdm
- lxdm etc…
These are are applications that initialize the desktop environment when a user first launches their computer and offers a GUI interface for user login.
On top of the display managers are desktop environments.
Desktop Environments
Desktop environments
combine together a host of applications to give the user an intuitive and interactive experience. After user login at the display manager/login manager
, the display manager initiates the desktop environment.
This is where
- Gnome
- Xfce
- Kde, and
- Unity
…lie
Usually, these applications are coupled together into one package so you do not see it.
Desktop environments
offer a host of applications that are designed for each other and therefore work well with each other.
They are usually named under one package (e.g. Gnome, Kde, Unity etc.) as mentioned above, and give the user several features to make their desktop experience user-friendly.
Gnome comes with:
gnome-tools
,gnome-power-manager
,gnome-control-center
etc.Xfce
puts all its apps intoxfce4-goodies
(xfce4 — the current version) which constitutexfce4 desktop manager
,network-manager-applet
,xfce4-panel
etc.Kde
also comes packed with thedolphin
file manager,konsole
terminal and thekde plasma desktop manager
etc.
All of these are packed together with the Desktop Environment
so that you wouldn’t have to go through the trouble of installing them one-by-one.
And they are also designed to work with each other so they are efficient when packed together.
Window Managers
In all these stacked up applications comes the window manager
.
Just like how you would open a window in Microsoft Windows and Mac Os, well you open windows in Ubuntu and Pop Os and Fedora etc… too.
The window manager is — just like the name describes — a window manager. It controls the positioning of windows, their look-and-feel etc…
Every Desktop Environment
comes with its own Window Manager
.
Some well-known window managers include:
- Enlightenment
- fvwm
- kwin (kde windows manager)
- twm, and
- wmaker
These window managers
come packed together with their respective Desktop Environments
and so are designed to work well with them.
Tiling Window Managers
There are several layouts in which you can position your windows. You can stack up windows like in the image below…
Or you can grid windows like in the feature image of this story.
All the window managers mentioned up above i.e. window managers in Microsoft Windows, MacOs, Ubuntu, Fedora etc… only offer you by default the stacking layout.
This means when you open a window and then another window, the second window is drawn over the first. And then with your mouse you can move the windows around and give focus to the one you want.
But for tiling window managers, they do not work like those stated above. They position windows in tiles or grids
(like in a phone’s gallery application) and stacks or floating
layouts etc.
Here is what it looks like in i3 tiling window manager
With a tiling window manager
, you get a window manager that positions your windows for you as you open them, and all you get to do is control the layouts
in which you want your windows to be placed.
Also, you will be able to use only your keyboard to control your computer.
Tiling window managers are popular for helping you to let go of your mouse.
You can configure the window manager with shortcut keyboard keys which you would use to open different workspaces, open applications, lock your computer, close applications, reposition windows, take screenshots etc… and a whole lot.
More ideal is that there are so many layouts and you can — in many different window managers — configure your own layout. You are not stuck with one layout for your windows.
For people who open several applications on a daily basis just to get one thing done (Software Engineers and Other Engineers too 😃), tiling window managers are just the best.
Once again, remember everything is customizable so you can make/create the layouts and the configuration you want. Remember that.
So in all, what is a tiling window manager then?
A tiling window manager is a graphical application that helps you organize your desktop windows and gives you the extra feature of controlling your desktop with only your keyboard.
They do not come with extra applications like in the case of desktop environments (Kde, Gnome, Unity, Cinnamon etc.) where you have applications that help you connect to WiFi, Bluetooth devices and start terminals.
They are out-of-the-box just window managers.
So, before you switch to a tiling window manager, make sure you have a terminal application installed and you know the key combinations to at least start a terminal otherwise you would have to go back to a live installation CD or a tty to get it installed if you do not have another desktop environment already installed.
Some well known tiling window mangers are:
- Xmonad
- i3wm
- bwspm
- Awesome
- Sway etc.
Now, The Wrap Up
Let’s put it all together.
When you start your computer, there is a daemon for the display server and it is started.
Just like a web server, it starts the basic process of listening for all these desktop, display etc… managers and for other events and draws to the screen using its compositor
.
When the display server
starts, a service or daemon for a display manager
must be available. Then the server gives control to the display manager
which starts up a login graphical interface
for user login.
The display manager / login manager
then gives the user a drop-down menu to choose which desktop environment or window manager
to use.
This choice is only available if the user has some stand-alone
tiling window manager like Xmonad — which can stand on its own as a desktop environment — installed.
And when the user logs in successfully, the display manager/login manager
starts the desktop environment
or the window manager
the user selected.
And from there, the user can start opening windows and applications whose positioning and look-and-feel are controlled by either the desktop environment
or the window manager
based on the user's selection at the login.
This process starts automatically on all Linux distributions that come prepacked with display managers;
for example Ubuntu
.
But for Arch Linux, Gentoo — which is based on Arch Linux — and some other distributions also, you only get the Linux Kernel at installation.
Which means they do not come pre-packed with all these applications. So you would have to understand this process so that you can install the appropriate
variants of all these softwares in order to get a working desktop environment
.
Appropriate in the sense that not all of them would work fine together.
Desktop Environments
come pre-packed with Login managers, window managers
and a whole suite of applications which are designed to work together. But, tiling window managers
are stand-alone applications.
They do not come with a whole list of applications — which are basically bloat because you would not use all of them.
This means that when you use a tiling window manager that runs on top of the Xorg server, without a display server
or a desktop environment
— which is very possible and doable because I do it — then you would have to install every single application you need yourself.
If you need a file manager, you install it yourself. Need Firefox to browse the web? well, install it yourself. Want to take screenshots? Get a screen capture application then.
When you find yourself doing this, there is no guarantee all these applications will work fine together and that is because they were not designed to do so.
And so you will find yourself getting errors here and there and you might get fed up.
But, eventually when you get all the applications you need and they work fine together, using tiling window managers
alone without a desktop environment
can become the greatest best feeling you’d ever have.
If you are running Ubuntu or Fedora and you would want to take control of the startup of your Desktop so that you can use a Tiling window manager
as a stand-alone without a Desktop Environment
or a Display Server,
you can do it.
But, that is a topic for another day when I am feeling like it.
So, until then, take it easy folks ✌️