6.7. Desktop Environments

Contributed by Valentino Vaschetto.

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

6.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, anda 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. More information regarding GNOME on FreeBSD can be found on the FreeBSD GNOME Project's web site. The web site also contains fairly comprehensive FAQs about installing, configuring, and managing GNOME. Installing GNOME

The software can be easily installed from a package or the Ports Collection:

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

# pkg_add -r gnome2

For pkgng users, the equivalent command is:

# pkg install gnome2

To build GNOME from source, use the ports tree:

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

For proper operation, GNOME requires the /proc filesystem to be mounted. Add

proc /proc procfs rw 0 0

to /etc/fstab to mount procfs(5) automatically during startup.

Once GNOME is installed, the X server must be told to start GNOME instead of a default window manager.

The easiest way to start GNOME is with GDM, the GNOME Display Manager. GDM is installed as part of the GNOME desktop, although it is disabled by default. It can be enabled by adding this line to /etc/rc.conf:


Once you have rebooted, GDM will start automatically.

It is often desirable to start all GNOME services together with GDM. To achieve this, add the following line to /etc/rc.conf:


GNOME may also be started from the command-line by properly configuring a file named .xinitrc. If a custom .xinitrc is already in place, simply replace the line that starts the current window manager with one that starts /usr/local/bin/gnome-session instead. If nothing special has been done to the configuration file, then it is enough simply to type:

% echo "/usr/local/bin/gnome-session" > ~/.xinitrc

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


If an older 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/local/bin/gnome-session:

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

Yet another option is to configure the display manager to allow choosing the window manager at login time; the section on KDE details explains how to do this for KDM, the display manager of KDE.

6.7.2. KDE About KDE

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 55 languages

  • Centralized, consistent, dialog-driven desktop configuration

  • A great number of useful KDE applications

KDE comes with a web browser called Konqueror, which is a solid competitor to other existing web browsers on UNIX® systems. More information on KDE can be found on the KDE website. For FreeBSD specific information and resources on KDE, consult the KDE/FreeBSD initiative's website. Installing KDE

Just as with GNOME or any other desktop environment, the software can be easily installed from a package or the Ports Collection:

To install the KDE 4 package from the network, type:

# pkg_add -r kde4

pkg_add(1) will automatically fetch the latest version of the application.

For pkgng users, the equivalent command is:

# pkg install kde4

To build KDE from source, use the ports tree:

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

The first time the port is installed, a menu will be shown for selecting options. Accepting the defaults is recommended.

KDE 4 is a large application, and will take quite some time to compile even on a fast computer.

After KDE 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 "exec /usr/local/kde4/bin/startkde" > ~/.xinitrc

Now, whenever the X Window System is invoked with startx, KDE will be the desktop.

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

6.7.3. More Details on KDE

Now that KDE 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 (KDE, GNOME, or something else) to run after logging on.

KDE 4 requires that procfs(5) be mounted, and this line must be added to /etc/rc.conf:


6.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 applications launchers

  • Integrated window manager, file manager, sound manager, GNOME compliance module, and more

  • 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

To install the Xfce from the network, simply type:

# pkg_add -r xfce4

For pkgng users, the equivalent command is:

# pkg install xfce4

Alternatively, to build from source, use the Ports Collection:

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

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

% echo "/usr/local/bin/startxfce4" > ~/.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/local/bin/startxfce4 command; or, configure the display manager to allow choosing a desktop at login time, as explained in the section on kdm.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.

Send questions about this document to <freebsd-doc@FreeBSD.org>.