Introduction to X
The X Window System (sometimes just called "X") is the environment which
provides graphics services to OpenBSD and other Unix-based systems.
By itself, X provides very little, since one also must have a window manager
to present a user interface.
OpenBSD ships with the cwm(1),
fvwm(1) and
twm(1) window managers, although
many others are available as packages.
It is possible to run X clients on a system without any graphical support.
For example, one could have an application (the X client) running on an
ARM system, displaying its output on an amd64's graphical display (the X
server).
Since X is a well-defined, cross-platform protocol, it is even possible
to have an X application running on (for example) a Linux machine use an
OpenBSD machine for its display.
The client and server can also be running on the same machine, and for
most of this section, that will be the assumption.
Configuring X
For the majority of hardware on the most common platforms, X requires no
configuration at all.
The details of manual X configuration vary considerably from platform
to platform.
In all cases, there will be instructions and other platform-specific
information in /usr/X11R6/README on the installed system.
Starting X
There are two common ways to run X: by manually invoking the
startx(1) command at
a console, or via xenodm(1).
If you didn't enable xenodm at install time, you can do so like any other
system daemon:
# rcctl enable xenodm
On some platforms, you will need to disable the console
getty(8) to use xenodm.
This is not needed on amd64, i386 or macppc.
Customizing X
OpenBSD's default X environment is fully functional, but you may wish to
customize it.
When an X session is started, shell scripts in the user's home directory can be
used to start as many programs as desired.
Most of the programs in these scripts should run in the background,
but the last one (typically the window manager) should run in the foreground.
When the window manager exits, the script will exit, and X will shut down or
return to the xenodm(1)
login prompt.
- The startx(1) command
looks for a $HOME/.xinitrc script.
If this script doesn't exist, the system's /etc/X11/xinit/xinitrc
file is used instead.
- After the user logs in from
xenodm(1), the
/etc/X11/xenodm/Xsession script checks whether there is a
$HOME/.xsession script.
In the simplest case, your .xinitrc or .xsession script
contains only one line specifying your preferred window manager:
cwm
Or you can get a little more fancy:
export ENV=$HOME/.kshrc
xconsole -geometry -0+0 -fn 5x7 &
oclock -geometry 75x75-0-0 &
xsetroot -solid grey &
cwm
Note that the window manager cwm(1)
is not being run in the background.
This means that X will stay running until it exits.