Chapter 7. The X Window System

Table of Contents

7.1. Key packages
7.2. Setting up desktop environment
7.2.1. Debian menu
7.2.2. menu
7.2.3. Debian menu from menu
7.3. The server/client relationship
7.4. The X server
7.4.1. The (re)configuration of the X server
7.4.2. The connection methods to the X server
7.5. Starting the X Window System
7.5.1. Starting X session with gdm3
7.5.2. Customizing the X session (classic method)
7.5.3. Customizing the X session (new method)
7.5.4. Connecting a remote X client via SSH
7.5.5. Secure X terminal via the Internet
7.6. Fonts in the X Window
7.6.1. Basic fonts
7.6.2. Additional fonts
7.6.3. CJK fonts
7.7. X applications
7.7.1. X office applications
7.7.2. X utility applications
7.8. The X trivia
7.8.1. Clipboard
7.8.2. Keymaps and pointer button mappings in X
7.8.3. Classic X clients
7.8.4. The X terminal emulator — xterm
7.8.5. Running X clients as root
[Warning] Warning

This chapter is getting outdated since this is based on Debian 7.0 (Wheezy) released in 2013.

The X Window System on the Debian system is based on the source from X.Org.

There are a few (meta)packages provided to ease installation.

For the basics of X, refer to X(7) and the LDP XWindow-User-HOWTO.

A desktop environment is usually a combination of a X window manager, a file manager, and a suite of compatible utility programs.

You can setup a full desktop environment such as GNOME, KDE, Xfce, or LXDE, from the aptitude under the task menu.

[Tip] Tip

Task menu may be out of sync with the latest package transition state under Debian unstable/testing environment. In such situation, you need to deselect some (meta)packages listed under aptitude(8) task menu to avoid package conflicts. When deselecting (meta)packages, you must select certain packages providing their dependencies manually to avoid them deleted automatically.

You may alternatively setup a simple environment manually just with a X window manager such as Fluxbox.

See Window Managers for X for the guide to the X window manager and the desktop environment.

Debian menu system provides a general interface for both text- and X-oriented programs with update-menus(1) from the menu package. Each package installs its menu data in the "/usr/share/menu/" directory. See "/usr/share/menu/README".

In order to access the traditional Debian menu from the menu compliant window manager environment such as GNOME and KDE, you must install the menu-xdg package.

The X Window System is activated as a combination of the server and client programs. The meaning for the words server and client with respect to the words local and remote requires attention here.

Modern X servers have the MIT Shared Memory Extension and communicate with their local X clients using the local shared memory. This bypasses the network transparent Xlib interprocess communication channel and gains performance for large images.

See xorg(1) for X server information.

The X Window System is usually started as an X session which is the combination of an X server and connecting X clients. For the normal desktop system, both of them are executed on a workstation.

The X session is started by one of the following.

  • startx command started from the command line

  • One of the X display manager daemon programs *dm started from the end of the start up script in "/etc/rc?.d/" ("?" corresponding to the runlevel) directory

[Tip] Tip

The start up script for the display manager daemons checks the content of the "/etc/X11/default-display-manager" file before actually executing themselves. This ensures to have only one X display manager daemon program activated.

[Tip] Tip

See Section 8.3.5, “Specific locale only under X Window” for initial environment variables of the X display manager.

Essentially, all these programs execute the "/etc/X11/Xsession" script. Then the "/etc/X11/Xsession" script performs run-parts(8) like action to execute scripts in the "/etc/X11/Xsession.d/" directory. This is essentially an execution of the first program which is found in the following order by the exec builtin command.

  1. The script specified as the argument of "/etc/X11/Xsession" by the X display manager, if it is defined.

  2. The "~/.xsession" or "~/.Xsession" script, if it is defined.

  3. The "/usr/bin/x-session-manager" command, if it is defined.

  4. The "/usr/bin/x-window-manager" command, if it is defined.

  5. The "/usr/bin/x-terminal-emulator" command, if it is defined.

This process is affected by the content of "/etc/X11/Xsession.options". The exact programs to which these "/usr/bin/x-*" commands point, are determined by the Debian alternatives system and changed by "update-alternatives --config x-session-manager", etc.

See Xsession(5) for details.

gdm3(1) lets you select the session type (or desktop environment: Section 7.2, “Setting up desktop environment”), and language (or locale: Section 8.3, “The locale”) of the X session from its menu. It keeps the selected default value in "~/.dmrc" as the following.


Fontconfig 2.0 was created to provide a distribution independent library for configuring and customizing font access in 2002. Debian after squeeze uses Fontconfig 2.0 for its font configuration.

Font supports on X Window System can be summarized as follows.

You can check font configuration information by the following.

  • "xset q" for core X11 font path

  • "fc-match" for fontconfig font default

  • "fc-list" for available fontconfig fonts

[Tip] Tip

"The Penguin and Unicode" is a good overview of modern X Window System. Other documentations at should provide good information on Unicode fonts, Unicode-enabled software, internationalization, and Unicode usability issues on free/libre/open source (FLOSS) operating systems.

There are 2 major types of computer fonts.

  • Bitmap fonts (good for low resolution rasterization)

  • Outline/stroke fonts (good for high resolution rasterization)

While scaling of bitmap fonts causes jugged image, scaling of outline/stroke fonts produces smooth image.

Bitmap fonts on the Debian system are usually provided by compressed X11 pcf bitmap font files having their file extension ".pcf.gz".

Outline fonts on the Debian system are provided by the following.

  • PostScript Type 1 font files having their file extension ".pfb" (binary font file) and ".afm" (font metrics file).

  • TrueType (or OpenType) font files usually having their file extension ".ttf".

[Tip] Tip

OpenType is intended to supersede both TrueType and PostScript Type 1.

Table 7.5. Table of corresponding PostScript Type 1 fonts

font package popcon size sans-serif font serif font monospace font source of font
PostScript N/A N/A Helvetica Times Courier Adobe
gsfonts I:703 4439 Nimbus Sans L Nimbus Roman No9 L Nimbus Mono L URW (Adobe compatible size)
gsfonts-x11 I:134 96 Nimbus Sans L Nimbus Roman No9 L Nimbus Mono L X font support with PostScript Type 1 fonts.
t1-cyrillic I:23 4884 Free Helvetian Free Times Free Courier URW extended (Adobe compatible size)
lmodern I:148 33270 LMSans* LMRoman* LMTypewriter* scalable PostScript and OpenType fonts based on Computer Modern (from TeX)

Table 7.6. Table of corresponding TrueType fonts

font package popcon size sans-serif font serif font monospace font source of font
ttf-mscorefonts-installer V:1, I:90 125 Arial Times New Roman Courier New Microsoft (Adobe compatible size) (This installs non-free data)
fonts-liberation I:575 2093 Liberation Sans Liberation Serif Liberation Mono Liberation Fonts project (Microsoft compatible size)
fonts-freefont-ttf V:38, I:382 10747 FreeSans FreeSerif FreeMono GNU freefont (Microsoft compatible size)
fonts-dejavu I:489 39 DejaVu Sans DejaVu Serif DejaVu Sans Mono DejaVu, Bitstream Vera with Unicode coverage
fonts-dejavu-core V:310, I:724 2954 DejaVu Sans DejaVu Serif DejaVu Sans Mono DejaVu, Bitstream Vera with Unicode coverage (sans, sans-bold, serif, serif-bold, mono, mono-bold)
fonts-dejavu-extra I:510 7217 N/A N/A N/A DejaVu, Bitstream Vera with Unicode coverage (oblique, italic, bold-oblique, bold-italic, condensed)
ttf-unifont I:23 16903 N/A N/A unifont GNU Unifont, with all printable character code in Unicode 5.1 Basic Multilingual Plane (BMP)

[Tip] Tip

DejaVu fonts are based on and superset of Bitstream Vera fonts.

Here are some key points focused on fonts of CJK characters.

Font name such as "VL PGothic" with "P" is a proportional font which corresponds to the fixed width "VL Gothic" font.

For example, Shift_JIS code table comprises 7070 characters. They can be grouped as the following.

  • JIS X 0201 single-byte characters (191 characters, a.k.a. half-width characters)

  • JIS X 0208 double-byte characters (6879 characters, a.k.a. full-width characters)

Double-byte characters occupy double width on console terminals which uses CJK fixed width fonts. In order to cope with such situation, Hanzi Bitmap Font (HBF) File with file extension ".hbf" may be deployed for fonts containing single-byte and double-byte characters.

In order to save space for TrueType font files, TrueType font collection file with file extension ".ttc" may be used.

In order to cover complicated code space of characters, CID keyed PostScript Type 1 font is used with CMap files starting themselves with "%!PS-Adobe-3.0 Resource-CMap". This is rarely used for normal X display but used for PDF rendering etc. (see Section 7.7.2, “X utility applications”).

[Tip] Tip

The multiple glyphs are expected for some Unicode code points due to Han unification. One of the most annoying ones are "U+3001 IDEOGRAPHIC COMMA" and "U+3002 IDEOGRAPHIC FULL STOP" whose character positions differ among CJK countries. Configuring priority of Japanese centric fonts over Chinese ones using "~/.fonts.conf" should give peace of minds to Japanese.