Setting Up X

The OpenBSD developers modified the industry-standard X graphic interface provided by X.Org to better fit with OpenBSD. The combination of X.Org and OpenBSD-specific patches is called Xenocara.

In most cases, Xenocara works exactly like X.Org, and X.Org documentation is applicable to OpenBSD. Most of Xenocara is there for security and for the convenience of developers building X, but there are a few additions. In my opinion, OpenBSD’s best enhancement to X.Org is the cwm(1) window manager. Here, we’ll cover configuring and starting X. The next section provides details about using the window manager.

Configuring X

Configuring X can be simple or agonizing, depending on your hardware.

Most video cards require special access to system memory, though some new Intel video cards can work without this access. For other cards, you must adjust the machdep.allowaperture=2 sysctl in /etc/sysctl.conf and reboot.

Most amd64 and i386 systems need machdep.allowaperture set to 2, but other platforms might require 1 or 2. Without this sysctl setting, the kernel will not permit X to communicate with the graphics card. If you’re in doubt, try X without changing the sysctl, and when you find out your hardware is too old or the wrong model to work that way, set it to 2.

After rebooting, see if X.Org can automatically set up your graphics interface by running startx. If it works, you should see the fvwm(1) desktop and a very bland gray background with a couple of terminal windows.

Note

If X doesn’t start, see the OpenBSD FAQ, the X.Org documentation, and /var/log/Xorg.0.log. Many things can go wrong with X autoconfiguration. Read your error log and search the Internet for solutions.

Once you know that X works, it’s time to decide whether you want to start X manually each time you need it or if you want OpenBSD to boot in to X automatically.

Starting X Manually

After logging into the text console, run startx(1). This command starts the commands in $HOME/.xinitrc and starts X.

Booting into X

OpenBSD includes an /etc/rc.conf hook for starting the X Display Manager, xdm(1), at boot time with a login prompt, but the default is to not use xdm. Here’s the line to add to your rc.conf.local to have xdm without any flags start X at boot:

xdm_flags=""

After booting, the console will show a graphical login prompt. Once a user logs in, xdm runs any commands in $HOME/.xsession.

Note

Because this is a chapter about using OpenBSD as a desktop, I assume that you’re using xdm(1). Examples refer to $HOME/.xsession. If you use startx(1) instead, substitute .xinitrc.

Emulating a Three-Button Mouse

A lot of X software expects you to have a mouse with three or more buttons, but many have only two buttons. Xenocara lets you pretend that you have a third mouse button, and when you press both mouse buttons simultaneously, it interprets that as pressing the nonexistent third button.

Of course, the best solution is to buy a real mouse with three or more buttons. They’re much easier to get than they used to be.

Now that you have X ready to use, let’s explore that cwm window manager I mentioned earlier.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.61.30