How a Display Manager and a Window Manager Light Up Your Screen
Image by Opensource.com CC-by-SA 4.0
Author’s note: Large parts of this article are excerpted from my book, “Using and Administering Linux: Volume 1 — Zero to SysAdmin: Getting Started, Second Edition,” Apress, 2023. Other parts of this article were written in 2016 and were used in creating that book and its 1st Edition.
Sometimes the best tools for a task are actually a pair of program types—not specific commands or programs. This article looks at two important program types that allow you to log in and work in a graphical environment: the display manager (dm) and the window manager (wm). These two programs, regardless of which ones you use on your Linux GUI desktop system, always work closely together to make your GUI experience smooth and seamless before you even get to your desktop.
Display manager
The display manager is a bit of code that provides the GUI login screen for your Linux desktop. After you log in to a GUI desktop, the display manager turns control over to the window manager. When you log out of the desktop, the display manager is given control again to display the login screen and wait for another login.
There are several display managers—some are provided with their respective desktops. Note that some display managers are not directly associated with a specific desktop. Any of the display managers can be used for your login screen regardless of which desktop you are using. And not all desktops have their own display managers. Such is the flexibility of Linux and well-written, modular code.
The most frequently used desktops and display managers are shown in Figure 1. There are many more.
Desktop | Display manager | Comments |
---|---|---|
GNOME | GDM | GNOME Display Manager |
KDE | KDM | KDE Display Manager (up through Fedora 20) |
LightDM | Lightweight Display Manager | |
LXDE | LXDM | LXDE Display Manager |
KDE | SDDM | Simple Desktop Display Manager (Fedora 21 and above) |
XDM | Default X Window System Display Manager |
The display manager for the first desktop (i.e., GNOME, KDE, etc.) installed is the default one. For Fedora, this is usually GDM, which is the display manager for GNOME. If GNOME is not installed, then the display manager for the installed desktop is the default. If the desktop selected during installation does not have a default display manager, then GDM is installed and used. If you use KDE as your desktop, the new SDDM (Simple Desktop Display Manager) will be the display manager.
Regardless of which display manager is configured as the default at installation time, later installation of additional desktops does not automatically change the display manager used. If you want to change the display manager, you must do it yourself from the command line. Any display manager can be used, regardless of which window manager and desktop is used.
Window manager
The function of a window manager is to manage the creation, movement, and destruction of windows on a GUI desktop. The window manager works with the X Window System or the newer Wayland to perform these tasks. The X Window System provides all of the graphical primitives and functions to generate the graphics for a Linux or Unix graphical user interface.
The window manager also controls the appearance of the windows it generates. This includes the functional decorative aspects of the windows, such as the look of buttons, sliders, window frames, pop-up menus, and more.
As with almost every other component of Linux, there are many different window managers from which to choose. The following list represents only a sample of the available window managers.
Desktop | Window manager | Comments |
---|---|---|
Unity | Compiz | |
Fluxbox | ||
FVWM | ||
IceWM | ||
KDE | Kwin | Starting with KDE Plasma 4 in 2008 |
GNOME | Metacity | Default for GNOME 2 |
GNOME | Mutter | Default starting with GNOME 3 |
twm | A very old and simple window manager. Some distros like Fedora use it as a fallback in case no other window manager or desktop is available. | |
Xfce | Xfwm |
Note that most window managers are not directly associated with any specific desktop. In fact, some window managers can be used without any type of desktop software, such as KDE or GNOME, to provide a minimalist GUI experience for users.
How do I deal with all these choices?
In most modern distributions, the choices are made for you at installation time and are based on your selection of desktops and the preferences of the packagers of your distribution. The desktop itself can be easily changed in some distributions and the display manager can also be changed in many cases.
Now that systemd has become the standard startup system in many distributions, you can set the preferred display manager in the /etc/systemd/system directory, which is where the basic system startup configuration is located. There is a symbolic link (symlink) named display-manager.service that points to one of the display manager service units in /usr/lib/systemd/system. Each installed display manager has a service unit in the /usr/lib/systemd/system directory.
To change the active display manager, remove the existing display-manager.service link and replace it with the one you want to use. For example, to configure to use the KDM display manager, use the following commands: cd /etc/systemd/system rm display-manager.service ln -s /usr/lib/systemd/system/kdm.service display-manager.service
I did find that some distros and desktops have various means of changing the window manager. For example, GNOME users can use gconf-editor and Puppy Linux uses the wmswitcher
command.
Experimenting with Window and Display Managers
Perform this experiment as root. We will install additional display managers and stand-alone window managers then switch between them.
Check and see which window managers are already installed. The RPMs in which the window managers are packaged have inconsistent naming so it is difficult to locate them using a simple DNF search unless you already know their RPM package names which, after a bit of research, I do.
# dnf list fluxbox fvwm icewm xorg-x11-twm xfwm4
Last metadata expiration check: 0:19:40 ago on Sun 05 Feb 2023 01:37:32 PM EST.
Installed Packages
xfwm4.x86_64 4.16.1-6.fc37 @anaconda
Available Packages
fluxbox.x86_64 1.3.7-20.fc37 fedora
fvwm.x86_64 2.6.9-8.fc37 fedora
icewm.x86_64 3.3.1-1.fc37 updates
Now let’s look at some of the display managers.
# dnf list gdm lightdm lxdm sddm xfdm xorg-x11-xdm
Last metadata expiration check: 0:20:23 ago on Sun 05 Feb 2023 01:37:32 PM EST.
Installed Packages
lightdm.x86_64 1.32.0-2.fc37 @anaconda
Available Packages
gdm.i686 1:43.0-3.fc37 fedora
gdm.x86_64 1:43.0-3.fc37 fedora
lightdm.i686 1.32.0-2.fc37 fedora
lxdm.x86_64 0.5.3-22.D20220831git2d4ba970.fc37 fedora
sddm.i686 0.19.0^git20221025.fc24321-1.fc37 fedora
sddm.x86_64 0.19.0^git20221025.fc24321-1.fc37 fedora
Each display manager is started as a systemd service so another way to determine which ones are installed is to check the /usr/lib/systemd/system/ directory. The lightdm display manager shows up twice as installed and available because there was an update for it at the time this task was performed.
# cd /usr/lib/systemd/system/ ; ll *dm.service
-rw-r--r--. 1 root root 1081 Jul 21 2022 lightdm.service
[root@studentvm1 system]#
Like my VM, yours should have only a single dm, the lightdm. Let’s install lxdm as the additional display manager, with FVWM, fluxbox, and icewm for window managers.
# dnf install -y lxdm fvwm fluxbox icewm
Now we must restart the display manager service to display the newly installed window managers in the display manager selection tool. The simplest way is to logout of the desktop and restart the dm from a virtual console session.
# systemctl restart display-manager.service
Or we could do this by switching to the multi-user target and them back to the graphical target. Do this, too, just to see what switching between these targets looks like.
# systemctl isolate multi-user.target
# systemctl isolate graphical.target
But this second method is a lot more typing. Logout, if necessary, to switch back to the lightdm login on vc1 and look in the upper right corner of the lightdm login screen. The leftmost icon, which on my VM looks like a sheet of paper with a wrench1 allows us to choose the desktop or window manager we want to use before we login. Click on this icon and choose FVWM from the menu in Figure 3, then login.
Explore this window manager by using a left-click on the desktop, open an Xterm instance, and locate the menu option that gives access to application programs. Figure 4 shows the Fvwm desktop (this is not a desktop environment like KDE or GNOME) with an open Xterm instance and a menu tree that is opened with a left click on the display. A different menu is opened with a right click.
Fvwm is a very basic but usable window manager. Like most window managers it provides menus to access various functions and a graphical display that supports simple windowing functionality. Fvwm also provides multiple windows in which to run programs for some task management capabilities.
Notice that the XDGMenu in Figure 4 also contains Xfce applications. The Start Here menu item leads to the Fvwm menus that include all of the standard Linux applications that are installed on the host.
After spending a bit of time exploring the Fvwm interface, logout. Can’t find the way to do that? Neither could I as it is very non-intuitive. Left click on the desktop and open the FvwmConsole. Then type in the command Quit – yes, with the uppercase Q – and press Enter. We could also open an Xterm session and use the following command which kills all instances of the Fvwm window manager belonging to the student user.
# killall fvwm
Try each of the other window managers, exploring the basic functions of launching applications and a terminal session. When you have finished that, exit whichever window manager you are in and login again using the Xfce desktop environment.
Change the display manager to one of the new ones we have installed. Each display manager has the same function, to provide a GUI for login and some configuration such as the desktop environment or window manager to start as the user interface. Change into the /etc/systemd/system/ directory and list the link for the display manager service.
# cd /etc/systemd/system/ ; ll display-manager.service
total 60
lrwxrwxrwx. 1 root root 39 Nov 5 04:18 display-manager.service -> /usr/lib/systemd/system/lightdm.servic
Locate all of the display manager services in the /usr/lib/systemd/system/ directory.
# ll /usr/lib/systemd/system/*dm.service
-rw-r--r--. 1 root root 1081 Jul 21 2022 /usr/lib/systemd/system/lightdm.service
-rw-r--r-- 1 root root 384 Sep 11 02:19 /usr/lib/systemd/system/lxdm.service
And make the change.
# rm -f display-manager.service
# ln -s /usr/lib/systemd/system/lxdm.service display-manager.service
# ll display-manager.service
lrwxrwxrwx 1 root root 36 Feb 5 16:08 display-manager.service -> /usr/lib/systemd/system/lxdm.service
As far as I can tell from my experiments at this point, rebooting the host is the only way to reliably activate the new dm. Go ahead and reboot your VM now to do that. Figure 5 shows what the lxdm display manager looks like.
Login using lxdm. Then log out and switch back to the lightdm.
Different distributions and desktops have various means of changing the window manager but, in general, changing the desktop environment also changes the window manager to the default one for that desktop. For current releases of Fedora Linux the desktop environment can be changed on the display manager login screen. If stand-alone display managers are also installed, they also appear in the list with the desktop environments.
There are many different choices for display and window managers available. When you install most modern distributions with any kind of desktop, the choices of which ones to install and activate are usually made by the installation program. For most users, there should never be any need to change these choices. For others who have different needs, or for those who are simply more adventurous, there are many options and combinations from which to choose. With a little research you can make some interesting changes.
1The icon on your version of lightdm might be different. This icon is used to show the currently selected DM so will change when you select a different one.
Final Thoughts
As with many other components of GNU/Linux, many different display and window managers are available. When you install most modern distributions with any kind of desktop, the installation program chooses which ones to install and activate. For most users, there should never be any need to change these choices. For others who have different needs or who are simply more adventurous, there are many options and combinations from which to choose. With a little research, you can make interesting changes.