Team LiB
Previous Section Next Section

Hack 22. Take Your Screens Black

Every time you start up an X11 session, the default background is an ugly gray mesh. Some window managers and desktop environments change this almost immediately, but others leave the background a putrid gray. Here's a tip on how you can make sure the default background is solid black. (In case you're wondering, the choice of colors for the background is like the choice for the Model T Fordyou can make it any color you want as long as it's black.)

The trick behind making the default background black is to add the -br switch to the right configuration file. Which configuration file needs to be modified depends on how you start your window manager or desktop.

4.2.1. startx

If you start your window manager with the startx command, edit the /usr/X11R6/bin/startx file. Make sure the default server arguments include the -br switch. For example, if the beginning of your startx file looks like this:

userclientrc=$HOME/.xinitrc
userserverrc=$HOME/.xserverrc
sysclientrc=/etc/X11/xinit/xinitrc
sysserverrc=/etc/X11/xinit/xserverrc
defaultclientargs=""
defaultserverargs="-nolisten tcp"
clientargs=""
serverargs=""

Add the -br switch to the definition for either defaultserverargs or serverargs. Just place the switch between the quotes. For example:

defaultserverargs="-nolisten tcp -br"

Now, when you run startx to start a window manager, the default background will be black instead of the gray mesh.

4.2.2. xinit

If you use the xinit command to start a window manager or desktop, add -- -br to the tail end of the command. For example, if you want to start the blackbox window manager with the xinit command, do it this way:

$ xinit /usr/bin/blackbox -- -br

If you use the xinit command to start a new window manager or desktop for a second user [Hack #19], add -- -br after the command and before you specify the next available virtual terminal. For example:

$ xinit /usr/bin/blackbox -- -br :1

4.2.3. The Xservers File

One or more of your desktop environments or window managers might use a file called Xservers to determine how to start the X11 engine that drives all window managers and desktops. In this case, log in as root and locate your Xservers file with this command:

# locate Xservers /etc/X11/xdm/Xservers

If you are using the XDM graphical login manager, this is the file you want to modify. You can find the Xservers file in the directory for the KDE graphical login manager, KDM, or in the directory for the GNOME graphical login manager, GDM. You might even find Xservers files in all three places. You only need to modify the Xservers that is connected to your login manager. Once you've found it, open the file with a text editor, and you should see a line that looks something like this:

:0 local@tty1 /usr/X11R6/bin/X -nolisten tcp

Simply add the -br switch to this line so that it looks more like this:

:0 local@tty1 /usr/X11R6/bin/X -br -nolisten tcp

Save your work, and that should transform the ugly gray pattern into solid black.

    Team LiB
    Previous Section Next Section