X Window System and Window Manager: Controlling and Managing Windows in the X Server

X Window System and Window Manager

X handles most keyboard input by sending key events to the window with “input focus”. This window is usually highlighted in some way.

Window managers make it possible to control a wide range of details about how windows appear on the screen. This includes cosmetic details like color of windows borders and what elements are displayed on each window.

X Window System

The X Window System is a network-based graphical display system. It uses a client-server architecture where the X server controls access to hardware devices that enable user applications to display graphics on the screen. This includes both input devices like mice and keyboards as well as output devices such as video adapters and monitors.

The underlying X architecture allows for many different ways of managing on-screen space. One way is for the X server to manage windows, but this would violate the X philosophy that separates policy from process, so the X server typically leaves that task to another program called a window manager.

A window manager determines where to place windows on the screen, what sort of decorations (icons, title bars and borders) they have and provides mechanisms for interacting with them. Most window managers also provide facilities for launching other client programs through a menu.

In addition, many window managers use “compositing” techniques to give a more 3-D look to the on-screen contents and have features for resizing and moving windows as well as for arranging them in groups and stacks. This work can be done on the X server but it’s becoming more common for window managers to bypass this and do it on the client application itself.

X Window Manager

The X Window System works on a client/server model. The X server manages access to the graphics card and display screen, and clients (application programs) talk to it via the X protocol. Typically, these client programs are referred to as windows. For example, a typical X session might start up two xterms and an xclock as window programs before starting the fvwm window manager.

The architecture of X provides mechanisms for the server to impose its own policy on windows — moving them, iconifying them, etc. Historically, some toolkits have taken advantage of this infrastructure to manage the X window space. In modern times, though, most of the X work is done by another program — a program called a window manager.

Basically, a window manager is an application that decides where other windows should be placed, provides mechanisms for users to control those positions and sizes, and generally “decorates” the window area. Several such programs are available in the pkgsrc archive, including the very basic ctwm and the desktop environments of Openbox and Cinnamon. Others are a bit more elaborate, such as i3 and tiling managers like Larswm and LeftWM. Some offer compositing as well. All of these, of course, require the X server to be running.

X Server

The X server provides the screen on which other programs (called clients) are displayed. It also processes input from the mouse and keyboard. When a client program sends an event to the server, it is handled and a response is sent back to the client application. The X server can also perform graphics operations, such as rotating windows.

Normally, a desktop environment such as Gnome or KDE runs on top of the X server. In addition, many users have their own window managers. A window manager is a “meta-client” whose most basic function is to manage other client applications. Some window managers provide a way to launch other client applications; others simply allow the user to type standard commands into a command box and have the X server execute them.

There are a large number of window managers available for the X server. Some of them are graphical, while others are text-based. Several of these window managers are minimalist, aiming for simplicity and speed. Examples include icewm, evilwm, and jbwm. These are accompanied by more advanced GUIs such as Enlightenment, lxde, and gtk.

Walk back to the main page