DragonFly BSD


The X Window System

Updated for X.Org's X11 server by Ken Tom and Marc Fonvieille. Updated for DragonFly by Victor Balada Diaz. Updated for 2014 pkgng by Warren Postma.


This chapter will cover the installation and some configuration of the usual way of giving your Dragonfly BSD system an X-Windows style Graphical User Interface (GUI) and a modern Desktop Environment. In Unix systems, the graphical drawing system is provided by the combination of an X11R6 compliant X-Windows Server, such as the X.org server, and other software such as Window Managers and Desktop Environments. This multi-layered approach may be surprising to people coming from systems like the Mac or like Windows where these components are not so flexible, or provided by so many separately installed and configured pieces.

For more information on the video hardware support in X.org, check the X.org web site. If you have problems configuring your X server, just search the web. There are lots of tutorials and guides on how to set up your X properly, if the information in this page is not enough for your situation.

Before reading this chapter, you should know how to install additional third-party software. Read the dports section of the documentation, for DragonFly 3.4 and later.

You may find the FreeBSD X Configuration instructions apply exactly and unchanged in DragonFly BSD. They are found here.

Understanding X

What is X.org

X.org is the most popular free implementation of the X11 specification. The X11 specification is an open standard, and there are other implementations, some commercial, and some free.

The Window Manager and the Desktop Environment

An X Server is a very low level piece of software. It does not provide any way to move windows around or resize them. It does not provide a title bar on the top of your windows, or a dock, or any menus.

These things are the job, in the oldest style of X environment, of your window manager, or in more recent times, of a Desktop Environment.

Installing X.org by itself does not give you any window manager or any desktop environment. You will have to choose one and install it yourself. Until you select one, your system will not be usable.

There are dozens of window managers and desktop environments available for X. The most retro ones you might chose include fvwm and twm which have that retro 1980s workstation look and feel. There are also window managers included inside modern desktop environments like XFCE, KDE and GNOME.

If you are brand new and don't know what to do, select the XFCE desktop environment and follow those instructions. Every desktop environment or window manager also has a different configuration mechanism. Read your chosen environment's documentation to learn more. Some are configured by text files alone, and some (like KDE and GNOME) have sophisticated graphical configuration utilities and "control panels".

Note that XFCE, KDE and GNOME are all desktop environments, which already include the corresponding window manager.

Installing X

X.org is currently available in the DragonFly dports collection.

To install:

# pkg install xorg


# cd /usr/dports/x11/xorg/
# make install clean

Configuring X

Xorg can often work without any configuration file. The TWM window manager is include by default.

You can launch Xorg with TWM by Simply typing at prompt:

% startx

If this does not work, or if the default configuration is not acceptable, then X11 must be configured manually.

You can put your configuration files in /usr/local/etc/X11/

See Xorg web site for more information on configuration files.

After DragonflyBSD 4.4, for 3D acceleration, you have to add the user running Xorg to video group :

# pw groupmod video -m username

You can try the command :

# Xorg -configure

For generating configuration files in /root/, then copy it to /usr/local/etc/X11/

However, -configure option seems broken for some people, please run Xorg without configuration files or create them manually.

The X11 configuration process is now complete. You can start X.org with startx(1). The X11 server may also be started with the use of xdm(1).

The X Display Manager

Contributed by Seth Kingsley.


The X Display Manager ( XDM ) is an optional part of the X Window System that is used for login session management. This is useful for several types of situations, including minimal "X Terminals", desktops, and large network display servers. Since the X Window System is network and protocol independent, there are a wide variety of possible configurations for running X clients and servers on different machines connected by a network. XDM provides a graphical interface for choosing which display server to connect to, and entering authorization information such as a login and password combination.

Think of XDM as providing the same functionality to the user as the getty(8) utility. That is, it performs system logins to the display being connected to and then runs a session manager on behalf of the user (usually an X window manager). XDM then waits for this program to exit, signaling that the user is done and should be logged out of the display. At this point, XDM can display the login and display chooser screens for the next user to login.

Installing XDM

# pkg install xdm


# cd /usr/dports/x11/xdm/
# make install clean

Using XDM

The XDM daemon program is located in /usr/local/bin/xdm. This program can be run at any time as root and it will start managing the X display on the local machine. If XDM is to be run every time the machine boots up, a convenient way to do this is by adding an entry to /etc/ttys. There is a line in the default /etc/ttys file for running the XDM daemon on a virtual terminal:

ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   off secure

By default this entry is disabled; in order to enable it change field 5 from off to on and restart init(8). The first field, the name of the terminal this program will manage, is ttyv8. This means that XDM will start running on the 9th virtual terminal.

Each user must put the appropriate line in ~/.xsession in order to start his window manager.

Configuring XDM

The XDM configuration directory is located in /var/lib/xdm. The sample configuration files are in /usr/local/share/examples/xdm/, in this directory there are several files used to change the behavior and appearance of XDM . Typically these files will be found:

File Description
Xaccess Client authorization ruleset.
Xresources Default X resource values.
Xservers List of remote and local displays to manage.
Xsession Default session script for logins.
Xsetup_* Script to launch applications before the login interface.
xdm-config Global configuration for all displays running on this machine.
xdm-errors Errors generated by the server program.
xdm-pid The process ID of the currently running XDM.

Also in this directory are a few scripts and programs used to set up the desktop when XDM is running. The purpose of each of these files will be briefly described. The exact syntax and usage of all of these files is described in xdm(1).

The default configuration is a simple rectangular login window with the hostname of the machine displayed at the top in a large font and "Login:" and "Password:" prompts below. This is a good starting point for changing the look and feel of XDM screens.


The protocol for connecting to XDM controlled displays is called the X Display Manager Connection Protocol (XDMCP). This file is a ruleset for controlling XDMCP connections from remote machines. It is ignored unless the xdm-config is changed to listen for remote connections. By default, it does not allow any clients to connect.


This is an application-defaults file for the display chooser and the login screens. This is where the appearance of the login program can be modified. The format is identical to the app-defaults file described in the X11 documentation.


This is a list of the remote displays the chooser should provide as choices.


This is the default session script for XDM to run after a user has logged in. Normally each user will have a customized session script in ~/.xsession that overrides this script.


These will be run automatically before displaying the chooser or login interfaces. There is a script for each display being used, named Xsetup_ followed by the local display number (for instance Xsetup_0). Typically these scripts will run one or two programs in the background such as xconsole.


This contains settings in the form of app-defaults that are applicable to every display that this installation manages.


This contains the output of the X servers that XDM is trying to run. If a display that XDM is trying to start hangs for some reason, this is a good place to look for error messages. These messages are also written to the user's ~/.xsession-errors file on a per-session basis.

Running a Network Display Server

In order for other clients to connect to the display server, edit the access control rules, and enable the connection listener. By default these are set to conservative values. To make XDM listen for connections, first comment out a line in the xdm-config file:

! SECURITY: do not listen for XDMCP or Chooser requests

! Comment out this line if you want to manage X terminals with xdm

DisplayManager.requestPort:     0

and then restart XDM . Remember that comments in app-defaults files begin with a "!" character, not the usual "#". More strict access controls may be desired. Look at the example entries in Xaccess, and refer to the xdm(1) manual page for further information.

Replacements for XDM

Several replacements for the default XDM program exist. One of them, kdm (bundled with KDE ) is described later in this chapter. The kdm display manager offers many visual improvements and cosmetic frills, as well as the functionality to allow users to choose their window manager of choice at login time.

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 .



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

GNOME can be easily installed from a package or from dports:

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

# pkg install gnome3

To build GNOME from source, see the chapter on dports for more information:

# cd /usr/dports/x11/gnome3

# make install clean

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 , which is installed as a part of the GNOME desktop (but is disabled by default), can be enabled by adding gdm_enable="YES" to /etc/rc.conf. Once you have rebooted, GNOME will start automatically once you log in -- no further configuration is necessary.

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/pkg/bin/gnome-session instead. If nothing special has been done to the configuration file, then it is enough simply to type:

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

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

Note: 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/pkg/bin/gnome-session :

% echo "#!/bin/sh" > ~/.xsession

% echo "/usr/pkg/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 explains how to do this for kdm , the display manager of KDE .

Anti-aliased Fonts with GNOME

X11 supports anti-aliasing via its RENDER extension. GTK+ 2.0 and greater (the toolkit used by GNOME ) can make use of this functionality.

So, with up-to-date software, anti-aliasing is possible within the GNOME desktop. Just go to Applications->Desktop Preferences->Font , and select either Best shapes, Best contrast, or Subpixel smoothing (LCDs). For a GTK+ application that is not part of the GNOME desktop, set the environment variable GDK_USE_XFT to 1 before launching the program.

Other Desktop based on Gnome

You can install and configure mate or cinnamon (forks of Gnome) with the same procedure.

Installation :

# pkg install mate (or cinnamon)


# cd /usr/dports/x11/mate (or cinammon)

# make install clean

You have to activate dbus and hal and install a display manager or use .xinitrc to login like so:

Edit /etc/rc.conf


Edit in home user .xinitrc

exec mate-session


About KDE

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

Installing KDE

Just as with GNOME or any other desktop environment, the easiest way to install KDE is through the pkgsrc framework or from a package:

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

# pkg install kde

To build KDE from source, using the dports:

# cd /usr/dports/x11/kde4

# make install clean

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 dbus-run-session 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.

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.

To enable kdm , the ttyv8 entry in /etc/ttys has to be adapted. The line should look as follows:

ttyv8 "/usr/local/bin/kdm -nodaemon" xterm on secure


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:

More information on Xfce can be found on the Xfce website.

Installing Xfce

A binary package for Xfce exists. To install, simply type:

# pkg install xfce

This should install the main xfce4 desktop package, and most of the required components.

Alternatively, to build from source, use dports:

# cd /usr/dports/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.