Welcoming to my customizing X page. There are a million and one obvious ways to customize X, I will not be covering those specific to a various Window Manger or graphical environment. I will cover some distro-specific examples at the end.
Changing your background is not what this is about. Here are some of the things that I think people should know about when customizing XFree86.
Introduction to the X Startup Process
Well, I decided to start tweaking my X for various reasons, and the best place to start was in figuring out the process.
Unfortunately, every distribution customizes the way X starts up in a different way. In general, if you start x via the
startx command, then the xinit files are used as a guide for startup, and if you use a session manager such as
kdm, then the xsession files are used. If you get a graphical login prompt, then you are using a session manager.
In the case of
startx, first ~/.xinitrc is looked for, and if it is not found a system-wide file such as /etc/X11/xinit/xinitrc is read and used. This file is simply a shell script to start various programs, including a window manager.
In the case of a window manager, things get more interesting. More cool things can be done since there is a guiding process to prepare stuff for X and clean up when X exits. In this case your window manager invokes /etc/X11/Xsession, a shell script. This script does different things on each distribution, but in general it checks for a ~/.xsession file, and sets up many other things. There is also usually a directory of scripts in /etc/X11/ that it runs as well. Note that your ~/.xsession script must exit in order for xsession to continue on with the rest of what it must do, so the last line in there (which should be your window manager) should be run with exec.
Getting an SSH Agent to Run
Most distributions these days have configured the session manager to start an SSH Agent to run on x startup, and kill it on x shutdown.
Many times there is a configuration file (such as /etc/X11/Xsession.options on Debian) that defines whether or not this happens. Since this happens *after* other user programs and *after* X is started, if you are having trouble making this work, make sure your ~/.xsession's last statement uses exec. If in doubt, back it up and remove your ~/.xsession file and see if it is started. If it is, then your script isn't exiting.
Getting multiple displays
One nice thing about running linux (or any unix) is that every user can have their own username and password, their own customization, and can log in at the same time. Well, that's certainly true for terminal logins, but what about X?
If I step away from my machine and lock it, can my girlfriend use it without knowing my password AND without loggin me out? YES! The answer is to have multiple X sessions. And it is easy to configure (at least for xdm).
While you can manually start X on multiple virtual terminals, automating it makes the most sense when using a session manager, so we will cover that.
Xdm (and presumably other session managers) has a Xservers file in its /etc/X11/xdm configuration directory. You simply need to duplicate the lines in this file. Mine looks like this:
:0 local /usr/X11R6/bin/X :0 vt7 -nolisten tcp
:1 local /usr/X11R6/bin/X :1 vt8 -nolisten tcp
This specifices to start two instances of X: one on vt7 which will be display 0, and one on vt8 which will be display 1. The :0 specifies which display it will be, the local specifies that were talking about the local machine, the vt7 specifies which virtual terminal, and the -nolisten tcp prevents the X server from listening on a TCP socket (this is for security). The order is fairly important. The first 5 entries must be in that order, and after that are options to X.
What to Put in a .Xseesion
What might you want to put in an xsession? If you are running blackbox or fluxbox for a window manager, you might want to start your slit programs.
Many people want to start xautolock or xscreensaver. Setting your gamma with xgamma is also a helpful thing to do in a .xsesseion file.
Note that if you use a ~/.xsession file you must start your window manager from it. If you do not, none will be started!
Debian Specific Stuff
Debian uses xsession for both startx sessions and session manager sessions. This changes things quite a bit,so be careful with this.
Debian's /etc/X11/Xsession script uses /etc/X11/Xsession.options as a configuration file, and based on that configuration runs scripts in /etc/X11/Xsession.d/.
Debian's default window manager can be changed via the Debian Alternatives System. To see what options are available type, as root:
update-alternatives --list x-window-manager
To change the default, type:
update-alternatives --config x-window-manager
and choose your new favorite.
Mandrake Specific Stuff
Mandrake has some cool things they do as well. For starters, you don't need to use a .xsession to customize your startup. They have a ~/.desktop file that gets sourced by the xsession. The most common use for this file is the set the variable $DESKTOP to your preferred window manager such as "DESKTOP=fluxbox". To get a list of possible values for DESKTOP, do:
Note that case seems to matter. Additionally, you may put other commands in ~/.desktop. This has the subtle effect of making it possible to customize your X startup while not requireing you use a ~/.xsession, and thus not having to start your window manager yourself (by execing it in your .xsession file). This makes it easier to ensure that Xsession continues on with its own stuff.
Unfortunately, while Mandrake does use the Debian Alternatives System, they do not use it for window managers. To change the default window manager in Mandrake, edit /etc/sysconfig/desktop and set the DESKTOP variable the way you would in a ~/.desktop.
Lastly, Garrick, a friend of mine, and a mandrake expert points out that if you often switch desktops you can install Xtart and use that to start X. Xtart will give you a list of sessions prior to starting X, and then start the one you choose.
This page is © Phil Dibowitz 2001 - 2004