Setting up X.org and FluxBox on FreeBSD
In addition to being a great server FreeBSD can make a great workstation. This tutorial will take you through the basics of getting X.org running on FreeBSD with a window manager and introduce you to a few other great applications on X.org.
Before Installing X.org
Before installing X.org is it a good idea to run Cvsup to get the lastest version of the port.
You will also need to place the following line into your /etc/make.conf file to declare that you are going to be using X.org instead of the XFree86 port.
X_WINDOW_SYSTEM=xorg
Installing X.org
X.org can be installed from the ports with the following commands
# cd /usr/ports/x11/xorg
# make install
The process of compiling X.org may take a while depending on the speed of your machine.
Configuring X.org
The installation is the easy part, now comes the hard part of configuring your hardware in X.org. The best way to do this is use the X.org config script as root
# xorgconfig
Once you have finished the script it will write the file to /etc/X11/xorg.conf
/etc/X11/xorg.conf
The following is an example of setting up the resolution for 1280x1024 and 1024x768 at 24M colors.
Section "Screen"
Identifier "Screen 1"
Device "onboard"
Monitor "mx70"
DefaultDepth 24
Subsection "Display"
Depth 24
Modes "1280x1024" "1024x768"
ViewPort 0 0
EndSubsection
EndSection
Here the resolutions must be written in order of largest to smallest or you will be scrolling around on your desktop. To change between these two resolutions you would press ctrl+alt+"+" to get a higher resolution, and ctrl+alt+"-" to get smaller. And yes, that is control, alt, plus. All held down at once and in that order.
Setting up a wheel mouse
To add support for the wheel on a mouse the last two lines in the following example are needed to map the buttons
Identifier "Mouse1"
Driver "mouse"
Option "Protocol" "Auto"
Option "Device" "/dev/sysmouse"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"
Installing a Window Manager
After setting up X.org a Window Manager should be installed to help organize the desktop and make things all around easier. There are many to choose from in /usr/ports/x11-wm All the major ones are there such as KDE and Gnome. If you are looking for something similiar to windows one of these is a good choice. In this tutorial however we will be using FluxBox, which is a very light weight wm that is simple to use and configure. It can be installed from the ports at /usr/ports/x11-wm/fluxbox A gui also available for configuring fluxbox at /usr/ports/x11-wm/fluxconf
For more on setting up fluxbox read the Fluxbox tutorial.
Launching programs on startup with ~/.xinitrc
The .xinitrc file is run when X.org starts up, so this is where we need to place everything we want to load at startup. A basic .xinitrc file could look like this
exec xterm &
exec fluxbox
The above file would launch an xterm terminal and then load the window manager, which in this case is fluxbox. All programs being launched need an & after them so they will run in the background, the window manager however does not. Any program can be added to this file. If you wanted to also launch gkrellm and gaim on startup it would look something like this
exec xterm &
exec gaim &
exec gkrellm &
exec fluxbox
Starting X.org
Now that the .xinitrc file has been created X.org can be started by typing
# startx
X.org can be stopped by pressing ctrl+alt+backspace
If you have problems starting x go back and reconfigure your /etc/X11/xorg.conf file.
Setting the background
Once X.org is running the first thing you will want to do is get rid of the horrid default background. This can be done using either feh (/usr/ports/graphics/feh), Eterm (/usr/ports/x11/eterm), or a number of other programs not covered here. To set a file called mybg.jpg in your home dir to the background it would look like this in the two mentioned programs
# feh --bg-center ~/mybg.jpg
# Esetroot ~/mybg.jpg
In FluxBox one of these commands can be placed under the root command in a theme file which are found under ~/.fluxbox/styles This will automatically load that background when you choose the theme.
Getting Transparent Terminals
Both Eterm (/usr/ports/x11/eterm) and Wterm (/usr/ports/x11/wterm) allow for transparent terminals. In Wterm the options needed are
# wterm -fg white -tr
This creates a clear window with white text. If you have a very dark background this is alright, but in most cases you will want to add shading to make your text more readable.
# wterm -bg green -fg white -tr -sh
The above command creates a terminal window with a green transparent background and white text.
A clear transparent window in Eterm is created with
# Eterm --buttonbar=0 --trans -v -f white
A window shaded at 60% blue is created with
# Eterm --buttonbar=0 --trans --shade=60 --tint=blue -v -f white
To add these to your fluxbox menu (~/.fluxbox/menu) you would insert the follow sub group
[submenu] (Terminals)
[exec] (Wterm Blue) {wterm -bg blue -fg white -tr -sh}
[exec] (Wterm Green) {wterm -bg green -fg white -tr -sh}
[exec] (Wterm Red) {wterm -bg red -fg white -tr -sh}
[exec] (Wterm Orange) {wterm -bg orange -fg white -tr -sh}
[exec] (Wterm Clear) {wterm -fg white -tr}
[exec] (Eterm 20 Purple) {Eterm --buttonbar=0 --trans
--shade=20 --tint=purple -v -f white}
[exec] (Eterm 20 Gray) {Eterm --buttonbar=0 --trans
--shade=20 -v -f white}
[exec] (Eterm 60 Gray) {Eterm --buttonbar=0 --trans
--shade=60 -v -f white}
[exec] (Eterm 60 Blue) {Eterm --buttonbar=0 --trans
--shade=60 --tint=blue -v -f white}
[exec] (Eterm Clear) {Eterm --buttonbar=0 --trans
-v -f white}
[end]
Useful Programs
Here are some useful programs for everyday activities if you are using X
- XChat - graphical irc client
- GKrellM - A very nice looking system monitoring tool with many plugins
- WMWeather - A handy little box that sits in the corner of the screen and displays the current weather
- Gaim - IM client that supports MSN, Yahoo, AIM, Jabber, ICQ, and many others
- Mozilla - web browser and mail client
- Liferea - RSS Reader
- mplayer - plays movies