5.7 Desktop Environments

Contributed by Valentino Vaschetto.

This section describes the different desktop environments available for X on FreeBSD. A ``desktop environment'' will mean anything ranging from a simple window manager, to a complete suite of desktop applications such as KDE or GNOME.

5.7.1 GNOME About GNOME

GNOME is a user-friendly desktop environment that enables users to easily use and configure their computers. GNOME includes a panel (for starting applications and displaying status), a desktop (where data and applications can be placed), a set of standard desktop tools and applications, and a set of conventions that make it easy for applications to cooperate and be consistent with each other. Users of other operating systems or environments should feel right at home using the powerful graphics-driven environment that GNOME provides. Installing GNOME

The easiest way to install GNOME is through the ``Desktop Configuration'' menu during the FreeBSD installation process as described in Chapter 2. They can also be easily installed from a package or the ports collection:

To install the GNOME package from the network, simply type:

    # pkg_add -r gnome

To build GNOME from source, use the ports tree:

    # cd /usr/ports/x11/gnome
    # make install clean

Once GNOME is installed, the X server must be told to start GNOME instead of a default window manager. If a custom .xinitrc is already in place, simply replace the line that starts the current window manager with one that starts /usr/X11R6/bin/gnome-session instead. If nothing special has been done to configuration file, then it is enough to simply type:

    # echo "/usr/X11R6/bin/gnome-session" > ~/.xinitrc

Next, type startx, and the GNOME desktop environment will be started.

Note: If a display manager, like XDM, is being used, this will not work. Instead, create an executable .xsession file with the same command in it. To do this, edit the file and replace the existing window manager command with /usr/X11R6/bin/gnome-session:

    # echo "#!/bin/sh" > ~/.xsession
    # echo "/usr/X11R6/bin/gnome-session" >> ~/.xsession
    # chmod +x ~/.xsession

Another option is to configure the display manager to allow choosing the window manager at login time; the section on KDE2 details explains how to do this for kdm, the display manager of KDE. Anti-aliased fonts with GNOME

While anti-aliased fonts made their first appearance on XFree86 desktops in the KDE environment and are supported there in the standard installation, it is also possible to use them with gtk applications such as the GNOME environment. The most straightforward way is probably by using the libgdkxft library, in the x11/gdkxft port. After installing this port, read the /usr/X11R6/share/doc/gdkxft/README file carefully.

Then, all that is needed is to do is tell gtk applications to look for their font-rendering functions in libgdkxft.so before looking in the standard place, libgdk.so. This is easily accomplished by setting an environment variable to point to the right place; with the Bourne shell (/bin/sh) or similar shells, type the command (to start The Gimp, say)

    % LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so gimp

and with csh and similar shells, type

    % setenv LD_PRELOAD /usr/X11R6/lib/libgdkxft.so 
    % gimp

Or, the commands

    export LD_PRELOAD

can be put into .xinitrc, .xsession or in the appropriate place(s) in /usr/X11R6/lib/X11/xdm/Xsession, depending on how X is normally started. However, this short-cut may cause problems if Linux GTK binaries are run.

5.7.2 KDE2 About KDE2

KDE is an easy to use contemporary desktop environment. Some of the things that KDE brings to the user are:

  • A beautiful contemporary desktop

  • A desktop exhibiting complete network transparency

  • An integrated help system allowing for convenient, consistent access to help on the use of the KDE desktop and its applications

  • Consistent look and feel of all KDE applications

  • Standardized menu and toolbars, keybindings, color-schemes, etc.

  • Internationalization: KDE is available in more than 40 languages

  • Centralized consisted dialog driven desktop configuration

  • A great number of useful KDE applications

KDE has an office application suite based on KDE's ``KParts'' technology consisting of a spread-sheet, a presentation application, an organizer, a news client and more. KDE also comes with a web browser called Konqeuror, which represents a solid competitor to other existing web browsers on Unix systems. More information on KDE can be found on the KDE website. Installing KDE2

Just like with GNOME or any other desktop environment, the easiest way to install KDE is through the ``Desktop Configuration'' menu during the FreeBSD installation process as described in Chapter 2. Once again, the software can be easily installed from a package or from the ports collection:

To install the KDE2 package from the network, simply type:

    # pkg_add -r kde2

To build KDE from source, use the ports tree:

    # cd /usr/ports/x11/kde2
    # make install clean

After KDE2 has been installed, the X server must be told to launch this application instead of the default window manager. This is accomplished by editing the .xinitrc file:

    # echo "/usr/X11R6/bin/startkde" > ~/.xinitrc

Now, whenever invoke X-Windows with startx, KDE2 will be the desktop.

If a display manager such as xdm is being used, then configuration is slightly different. Edit the .xsession file instead. Instructions for kdm are described later in this chapter.

5.7.3 More Details on KDE2

Now that KDE2 is installed on the system, most things can be discovered through the help pages, or just by pointing and clicking at various menus. Windows or Mac users will feel quite at home.

The best reference for KDE is the on-line documentation. KDE comes with its own web browser, Konqueror, dozens of useful applications, and extensive documentation. The remainder of this section discusses the technical items that are difficult to learn by random exploration. The KDE display manager

An administrator of a multi-user system may wish to have a graphical login screen to welcome users. xdm can be used, as described earlier. However, KDE includes an alternative, KDM, which is designed to look more attractive and include more login-time options. In particular, users can easily choose (via a menu) which desktop environment (KDE2, GNOME, or something else) to run after logging on.

To begin with, run the KDE2 control panel, kcontrol, as root. It is generally considered unsafe to run the entire X environment as root. Instead, run the window manager as a normal user, open a terminal window (such as xterm or KDE's konsole, become root with su (the user must be in the wheel group in /etc/group for this), and then type kcontrol.

Click on the icon on the left marked System, then on Login manager. On the right there are various configurable options, which the KDE manual will explain in greater detail. Click on sessions on the right. Click New type to add various window managers and desktop environments. These are just labels, so they can say KDE and GNOME rather than startkde or gnome-session. Include a label failsafe.

Play with the other menus as well, they are mainly cosmetic and self-explanatory. When are done, click on Apply at the bottom, and quit the control center.

To make sure kdm understands what the labels (KDE, GNOME etc) mean, edit the files used by xdm.

Note: In KDE 2.2 this has changed: kdm now uses its own configuration files. Please see the KDE 2.2 documentation for details.

In a terminal window, as root, edit the file /usr/X11R6/lib/X11/xdm/Xsession. There is a section in the middle like this:

    case $# in
            case $1 in
                    exec xterm -geometry 80x24-0-0

A few lines need to be added to this section. Assuming the labels from used were ``KDE2'' and ``GNOME'', use the following:

    case $# in
            case $1 in
                    exec /usr/X11R6/bin/startkde
                    exec /usr/X11R6/bin/gnome-session
                    exec xterm -geometry 80x24-0-0

For the KDE login-time desktop background to be honored, the following line needs to be added to /usr/X11R6/lib/X11/xdm/Xsetup_0:


Now, make sure kdm is listed in /etc/ttys to be started at the next bootup. To do this, simply follow the instructions from the previous section on xdm and replace references to the /usr/X11R6/bin/xdm program with /usr/local/bin/kdm. Anti-aliased Fonts

Starting with version 4.0.2, XFree86 supports anti-aliasing via its "RENDER" extension, and starting with version 2.3, Qt (the toolkit used by KDE) supports this extension. Configuring this is described in Section 5.5.3 on antialiasing X11 fonts. So, with up-to-date software, anti-aliasing is possible on a KDE2 desktop. Just go to the KDE2 menu, go to Preferences -> Look and Feel -> Fonts, and click on the check box ``Use Anti-Aliasing for Fonts and Icons''. For a Qt application which is not part of KDE, the environment variable QT_XFT needs to be set to true before starting the program.

5.7.4 XFCE About XFCE

XFCE is a desktop environment based on the GTK toolkit used by GNOME, but is much more lightweight and meant for those who want a simple, efficient desktop which is nevertheless easy to use and configure. Visually, it looks very much like CDE, found on commercial Unix systems. Some of XFCE's features are:

  • A simple, easy-to-handle desktop

  • Fully configurable via mouse, with drag and drop, etc

  • Main panel similar to CDE, with menus, applets and app launchers

  • Integrated window manager, file manager, sound manager, GNOME compliance module, and other things

  • Themeable (since it uses GTK)

  • Fast, light and efficient: ideal for older/slower machines or machines with memory limitations

More information on XFCE can be found on the XFCE website. Installing XFCE

A binary package for xfce exists (at the time of writing). To install, simply type:

    # pkg_add -r xfce

Alternatively, to build from source, use the ports collection:

    # cd /usr/ports/x11-wm/xfce
    # make install clean

Now, tell the X server to launch XFCE the next time X is started. Simply type this:

    # echo "/usr/X11R6/bin/startxfce" > ~/.xinitrc

The next time X is started, XFCE will be the desktop. As before, if a display manager like xdm is being used, create an .xsession, as described in the section on GNOME, but with the /usr/X11R6/bin/startxfce command; or, configure the display manager to allow choosing a desktop at login time, as explained in the section on kdm.

This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.

For questions about FreeBSD, read the documentation before contacting <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.