What are the user interface subsystems, their components and responsibilities

desktopdesktop-environmentwindow-manager

I am trying to understand the different subsystems that are in charge of the user interface, the terminology to refer to them, and how they are structured; so far I know there are:

At the top level:

desktops? (kde, gnome, etc)

Then we have:

  • a display manager (also called desktop manager or desktop environment)
  • window manager
  • anything else?

I'm making this a community wiki, I'd like this to be a central place for *all there is to know (from the user perspective) regarding user interface subsystems in Linux; what I would like to know is what are the components of each, and what are the responsibilities of each, i.e. I would like to know things like:

  • what exactly is in charge of the global shortcut keys, when I open up the "run application" dialog, who is doing that, when I press a key to show the desktop, run a terminal, maximize a window, etc, who is capturing that and sending it over to the right window;
  • who is in charge of drawing the desktop, the workspaces, etc.
  • what are the environment variables that can give me information regarding these components
  • Is the "main menu" a subsystem, or a component of a subsystem?

It would also be nice to compile a list of the most popular desktops/subsystems, which ones run under each, can you mix and match desktops/desktop environments/window managers, etc?

Finally, how do I tell which desktop/subsystems are actually running (active?) on the system, can different users have a different subsystem each?

Best Answer

First of all, a Display Manager (or DM, e.g. xdm, gdm, kdm) is not the same as a Desktop Environment (or DE, e.g. GNOME, KDE, XFCE).

The Display Manager takes care of graphical login, and decides (or lets you choose) what session to run. Or what session*s* in case you choose the "switch user" menu option.

A Desktop Environment is basically a collection of programs (display manager, window manager, session manager, panels, configuration tools, etc.) and libraries (e.g. Gtk) that intend to give a consistent and integrated environment to work in.

A Window Manager manages windows: where to place them, move them, resize them, minimize/maximize them, tile them, etc.). It also handles the shortcuts to do those things. In some cases the window manager also paints the borders of windows, in other cases this task is off-handed to a "window decorator".

The "Run Application" dialog in GNOME is part of gnome-panel, but in another DE it could be another part of the environment.

Who is in charge of painting windows etc. depends; in case there is a "compositor" in use (often part of the window manager, e.g. in Compiz) then the compositor paints the windows on the screen, otherwise (as was usual in the past) it's the X-server doing that.

The Main Menu(s) are put on the screen by a part of gnome-panel, but the data used comes from a bunch of files in /usr/share/applications/ (possibly combined with an equivalent directory in your home for personal changes). Those files have a structure defined by FreeDesktop.org (a platform for different DEs to collaborate on common infrastructure), so that GNOME and KDE know about the same programs (but still can show them differently, and in some cases prioritize "native" programs over "foreign" ones).

And yes, different users can use a different session configuration (and can even define their own ones). In GDM, try the Session drop-down for the available choices.

Furthermore, it is possible to mix & match several components, but that will sometimes result in less cooperation and a loss of "smoothness" in how things work. One very well known example where things get exchanges is of course Compiz, which replaces Metacity if you want fancy desktop effects. But there are lots of other changes possible.

Related Question