old-www/HOWTO/XWindow-User-HOWTO/runningx.html

1662 lines
30 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Running X</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="The X Window User HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="XFree86"
HREF="xfree86.html"><LINK
REL="NEXT"
TITLE="More X Configuration"
HREF="moreconfig.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The X Window User HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="xfree86.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="moreconfig.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="runningx"
></A
>3. Running X</H1
><P
>&#13; Starting an <SPAN
CLASS="application"
>X</SPAN
> session is typically done in one of
two ways: the <SPAN
CLASS="application"
>X</SPAN
> session is started via a display
manager (like <B
CLASS="command"
>xdm</B
>), and the user logs in at a GUI screen.
Or, the user starts <SPAN
CLASS="application"
>X</SPAN
> manually after logging in to
a text console. The latter is typically done with the
<B
CLASS="command"
>startx</B
> command, which is a simple shell script wrapper
for <B
CLASS="command"
>xinit</B
>. <SPAN
CLASS="application"
>X</SPAN
> runs with root
privileges in either case, since it needs raw access to hardware devices.
</P
><P
>&#13; Typically, which method is used, is determined by the system
<SPAN
CLASS="QUOTE"
>"runlevel"</SPAN
>. The default runlevel to launch at boot is
generally set in <TT
CLASS="filename"
>/etc/inittab</TT
> on Linux:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/xdm -nodaemon
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; That would start <B
CLASS="command"
>xdm</B
>, and thus
<SPAN
CLASS="application"
>X</SPAN
>, at runlevel 5. It will <SPAN
CLASS="QUOTE"
>"respawn"</SPAN
>,
if it dies or is stopped for any reason. You can also use the
<SPAN
CLASS="QUOTE"
>"<B
CLASS="command"
>init</B
>"</SPAN
> command to change runlevels without
rebooting (see man page).
</P
><P
>&#13; Let's look briefly at both approaches, and then some additional configuration
to set up the user's working environment.
</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN358"
></A
>3.1. startx</H2
><P
>&#13; <B
CLASS="command"
>startx</B
> will start <SPAN
CLASS="application"
>X</SPAN
> by first
invoking <B
CLASS="command"
>xinit</B
>. By itself, this would put you at a blank,
fuzzy looking, bare-bones desktop with no Window Manager loaded.
<B
CLASS="command"
>xinit</B
> basically takes two sets of command line
arguments: client specifications (programs to run, etc), and server
specifications (X server options), separated by <SPAN
CLASS="QUOTE"
>"--"</SPAN
>. If no
client program is specified on the command line, <B
CLASS="command"
>xinit</B
>
will look for a <TT
CLASS="filename"
>.xinitrc</TT
> file in the user's home
directory, to run as a shell script. If found, this then would in turn run
whatever user specified commands to set up the environment, or launch
programs that the file contained. If this file does not exist,
<B
CLASS="command"
>xinit</B
> will use the following initial command:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
xterm -geometry +1+1 -n login -display :0
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; If no <TT
CLASS="filename"
>.xserverrc</TT
> is found in the user's home directory,
<SPAN
CLASS="application"
>X</SPAN
> itself will be started with the following command:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
X :0
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; As you see, this is not overly helpful as it just launches one
<SPAN
CLASS="application"
>xterm</SPAN
>. The <B
CLASS="command"
>startx</B
>
shell wrapper provides additional functionality and flexibility to
<B
CLASS="command"
>xinit</B
>. <B
CLASS="command"
>startx</B
> will invoke
<B
CLASS="command"
>xinit</B
> for us, and provide some simple configuration
options as well. You can also issue commands such as the following, for
instance:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
startx -- -dpi 100 -depth 16 #force X to 100 dots per inch
#and colordepth of 16 (X v4 syntax)
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; Anything after the double dashes are passed as arguments directly to the X
server via <B
CLASS="command"
>xinit</B
>. In this example, you can force
<SPAN
CLASS="application"
>X</SPAN
> to the resolution of your preference, and still
have it use the configuration files we will cover later in this document. See
the Xserver man page for more command line options.
</P
><P
>&#13; Instead of issuing the same command line every time, it is easier to use the
configuration files to store this type of information for us.
</P
><P
>&#13; If you take a look at the <B
CLASS="command"
>startx</B
> script
(<TT
CLASS="filename"
>/usr/X11R6/bin/startx</TT
> on my system), you see it uses
two default configuration files to help set up the
<SPAN
CLASS="application"
>X</SPAN
> environment: <TT
CLASS="filename"
>xinitrc</TT
> and
<TT
CLASS="filename"
>xserverrc</TT
>. It looks first in
<TT
CLASS="filename"
>/etc/X11/xinit/</TT
>, for the system wide files. It then
checks the user's home directory for similar files, which will take
precedence if found. Note that the latter are Unix style <SPAN
CLASS="QUOTE"
>"dot"</SPAN
> files
(e.g. <TT
CLASS="filename"
>~/.xinitrc</TT
>), and are executable shell scripts.
</P
><P
>&#13; You normally would not want to edit the system wide files, but you can freely
copy these to your home directory as a starting point, or just start from
scratch. As you can tell by the names, one helps set up the X server, and one
sets up <B
CLASS="command"
>xinit</B
> by executing commands, preparing the
environment and possibly starting client programs like
<B
CLASS="command"
>xterm</B
> or a Window Manager (yes, it's a client too).
</P
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN400"
></A
>3.1.1. xserverrc</H3
><P
>&#13; As with all XFree86 configuration files, this is a plain text file, and is
usually a simple, one line statement to start the X server. It can include
any valid command line options supported by your <SPAN
CLASS="application"
>X</SPAN
>
installation. If you always start <SPAN
CLASS="application"
>X</SPAN
> with your own
options, this should be easier than typing the options each time. One
possible <TT
CLASS="filename"
>~/.xserverrc</TT
>:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
exec X :0 -dpi 100 -nolisten tcp
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; This will start <SPAN
CLASS="application"
>X</SPAN
> on display :0, the first
<SPAN
CLASS="QUOTE"
>"display"</SPAN
>, at a dots-per-inch resolution of 100, and disables
TCP connections. See the Xserver man page for other valid options. This is
just an example.
</P
></DIV
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN411"
></A
>3.1.2. xinitrc</H3
><P
>&#13; <TT
CLASS="filename"
>xinitrc</TT
> is used to set up a suitable
<SPAN
CLASS="application"
>X</SPAN
> environment, and to launch other programs, a.k.a
<SPAN
CLASS="QUOTE"
>"clients"</SPAN
> that we may want available as soon as
<SPAN
CLASS="application"
>X</SPAN
> is started. You likely have a system wide
<TT
CLASS="filename"
>xinitrc</TT
> to start a predefined set off programs. To
customize this, create your own in your home directory. Name it
<TT
CLASS="filename"
>.xinitrc</TT
>, make sure it is an executable script, and
<B
CLASS="command"
>chmod +x</B
>. An example (slightly modified from the original
on my system):
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
# merge in defaults and keymaps
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
if [ -z "$BROWSER" ] ; then
# we need to find a browser on this system
BROWSER=`which netscape`
if [ -z "$BROWSER" ] || [ ! -e "$BROWSER" ] ; then
# not found yet
BROWSER=
fi
fi
if [ -z "$BROWSER" ] ; then
# we need to find a browser on this system
BROWSER=`which lynx`
if [ -z "$BROWSER" ] || [ ! -e "$BROWSER" ] ; then
# not found yet
BROWSER=
else
BROWSER="xterm -font 9x15 -e lynx"
fi
fi
export BROWSER
# start some nice programs
if [ -f $HOME/.Xclients ]; then
exec $HOME/.Xclients
else
xclock -geometry 50x50-1+1 &#38;
xterm -geometry 80x50+494+51 &#38;
if [ -f /usr/X11R6/bin/fvwm ]; then
exec fvwm
else
exec twm
fi
fi
#eof
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; Briefly, what this script does, is set up our working environment, with
<B
CLASS="command"
>xmodmap</B
> (keyboard) and <B
CLASS="command"
>xrdb</B
>
(application resource settings). More on these below. Then the shell variable
<TT
CLASS="literal"
>$BROWSER</TT
> is set for a GUI environment (Netscape in this
example) so that any applications that might expect this, have a reasonable
choice available. Then the presence of the file <TT
CLASS="filename"
>Xclients</TT
>
is checked, both as a system wide file and in the user's home directory. In
this particular example, this is where any client applications are to be
started, including a Window Manager (see below). These could just have as
easily been started here if we had wanted to. If an
<TT
CLASS="filename"
>Xclients</TT
> file can't be found, then a Window Manager is
started for us. Either <B
CLASS="command"
>fvwm</B
>, if available, or XFree86's
minimalist <B
CLASS="command"
>twm</B
> if not. If for some reason, neither of
these can be started, the script would exit, and <SPAN
CLASS="application"
>X</SPAN
>
would fail to start.
</P
></DIV
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN432"
></A
>3.1.3. Xclients</H3
><P
>&#13; Everything up to this point has followed pretty much a standard and
predictable sequence of events. To summarize, we have invoked
<B
CLASS="command"
>startx</B
>, which in turn invoked <B
CLASS="command"
>xinit</B
>,
which has parsed <TT
CLASS="filename"
>xinitrc</TT
> for initial settings. Most
Linuxes should follow this same sequence, though the various values and
settings may differ.
</P
><P
>&#13; We now are at the last link in the chain where the user normally would
specify his or her preferences, including the Window Manager and/or
desktop environment to be used. The system will provide sane, though possibly
uninteresting, defaults if the user has not done so. Presumably, this is why
you are here ;-)
</P
><P
>&#13; The Window Manager, or desktop environment, is typically the last application
started. If you want other programs (like <B
CLASS="command"
>xterm</B
>) started,
they should be started before the Window Manager and
<SPAN
CLASS="QUOTE"
>"backgrounded"</SPAN
> with an <SPAN
CLASS="QUOTE"
>"&#38;"</SPAN
>. This can all be
done in the user's <TT
CLASS="filename"
>~/.xinitrc</TT
>. Or as in the above
example, the actual applications are started from yet another script. Let's
look at one short, hypothetical such script, <TT
CLASS="filename"
>.Xclients</TT
>:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
#!/bin/bash
# ~/.Xclients, start my programs.
xset s off s noblank
xset m 30/10 4
xset r rate 200 40
xscreensaver &#38;
rxvt -geometry 80x50-50+150 &#38;
echo Starting Window Manager...
if [ -x /usr/X11R6/bin/wmaker ]; then
echo `date`: Trying /usr/X11R6/bin/wmaker... |tee -a ~/.wm-errors 2&#62;&#38;1
exec /usr/X11R6/bin/wmaker &#62;&#62; ~/.wm-errors 2&#62;&#38;1
fi
echo `date`: Failed, trying fvwm... |tee -a ~/.wm-errors 2&#62;&#38;1
# let's try regular fvwm (AnotherLevel doesn't work with fvwm1).
if [ -n "$(type -path fvwm)" ]; then
# if this works, we stop here
exec fvwm &#62;&#62; ~/.wm-errors 2&#62;&#38;1
fi
echo `date`: Failed, trying twm... |tee -a ~/.wm-errors 2&#62;&#38;1
# wow, fvwm isn't here either ...
# use twm as a last resort.
exec twm &#62;&#62; ~/.wm-errors 2&#62;&#38;1
# Dead in the water here, X will exit as well, sigh...
echo `date`: Unable to start a Window Manager ... |tee -a ~/.wm-errors 2&#62;&#38;1
# eof
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; This really isn't so different than what <TT
CLASS="filename"
>xinitrc</TT
> was
doing at all. We added a few wrinkles, including starting a screen saver, a
different terminal emulator that this user prefers (<B
CLASS="command"
>rxvt</B
>),
with even more setting up of the environment (monitor, mouse and keyboard) using
<B
CLASS="command"
>xset</B
> this time, and a different Window Manager than was
available with the system defaults. This is in the user's home directory, so
it will not be overwritten during upgrades too.
</P
><P
>&#13; Actually, <SPAN
CLASS="application"
>X</SPAN
> has already started at this point, and
we are just putting the finishing touches on the configuration. Notice the
Window Managers are not <SPAN
CLASS="QUOTE"
>"backgrounded"</SPAN
> with <SPAN
CLASS="QUOTE"
>"&#38;"</SPAN
>
here. This is important! Something has to run in the foreground, or
<SPAN
CLASS="application"
>X</SPAN
> will exit. We didn't start a desktop environment
in this example, like <SPAN
CLASS="application"
>KDE</SPAN
> or
<SPAN
CLASS="application"
>GNOME</SPAN
>, but if we did, this final application
would have to be <B
CLASS="command"
>gnome-session</B
> or
<B
CLASS="command"
>startkde</B
> instead. Since we are rolling our own here, if we
wanted to change Window Managers, all we have to do is edit this file, and
restart <SPAN
CLASS="application"
>X</SPAN
>. Vendor supplied configurations may be
more complex than this, but the same principles apply.
</P
><P
>&#13; As an afterword, do not think that any initial client applications
<EM
>must</EM
> be started as we've done here. This is how it has
been traditionally done, and some may prefer this approach. Most window
managers have their own built-in ways to start initial programs, as do
<SPAN
CLASS="application"
>KDE</SPAN
> and <SPAN
CLASS="application"
>GNOME</SPAN
>. See
the respective documentation.
</P
></DIV
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN465"
></A
>3.2. Display Managers</H2
><P
>&#13; The other, more common, approach is the <SPAN
CLASS="QUOTE"
>"GUI log-in"</SPAN
>, where
<SPAN
CLASS="application"
>X</SPAN
> is running before log-in. This is done with the
help of a <SPAN
CLASS="QUOTE"
>"display manager"</SPAN
>, of which there are various
implementations. XFree86 includes <B
CLASS="command"
>xdm</B
> (X Display Manager)
for this purpose, though your distribution may use one of the others such as
<B
CLASS="command"
>gdm</B
> (<SPAN
CLASS="application"
>GNOME</SPAN
>) or <B
CLASS="command"
>kdm</B
>
(<SPAN
CLASS="application"
>KDE</SPAN
>).
</P
><P
>&#13; Display managers really do much more than enable GUI style log-ins. They
are also used to manage local as well as remote <SPAN
CLASS="QUOTE"
>"displays"</SPAN
> on a
network. We shall not get into details on this here, but it is nicely covered in
the <I
CLASS="citetitle"
>Remote X Apps Mini HOWTO</I
> and the <I
CLASS="citetitle"
>XDMCP
HOWTO</I
> (see the <A
HREF="appendix.html#links"
>links section</A
>). For
our purposes here, they provide similar services to <B
CLASS="command"
>getty</B
>
and <B
CLASS="command"
>login</B
>, which allow users to log into a system and
start their default shell, but in a GUI environment.
</P
><P
>&#13; Here is an example of a more advanced usage of what else a display manager
might be used for, from Diego Zamboni:
</P
><A
NAME="AEN484"
></A
><BLOCKQUOTE
CLASS="BLOCKQUOTE"
><P
>&#13; I have two X sessions running with different resolutions. I switch between
them depending on whether my laptop is connected to an external monitor or
using its own LCD display.
</P
><P
>&#13; Here's my <TT
CLASS="filename"
>/usr/lib/X11/xdm/Xservers</TT
> file that initiates
both displays:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
:1 local /usr/X11R6/bin/X :1 -layout 1024x768
:0 local /usr/X11R6/bin/X :0 -layout 1600x1200
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; Then I have <SPAN
CLASS="QUOTE"
>"1024x768"</SPAN
> and <SPAN
CLASS="QUOTE"
>"1600x1200"</SPAN
> defined as
<SPAN
CLASS="QUOTE"
>"server layouts"</SPAN
> in my
<TT
CLASS="filename"
>/etc/X11/XF86Config-4</TT
>, as follows:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
Section "ServerLayout"
Identifier "1600x1200"
Screen "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "ServerLayout"
Identifier "1024x768"
Screen "Screen1" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
## snip ...
Section "Screen"
Identifier "Screen0"
Device "S3 Savage/MX"
Monitor "Monitor0"
DefaultDepth 16
Subsection "Display"
Depth 16
Modes "1600x1200" "1280x1024" "1024x768"
EndSubsection
EndSection
Section "Screen"
Identifier "Screen1"
Device "S3 Savage/MX"
Monitor "Monitor0"
DefaultDepth 16
Subsection "Display"
Depth 16
Modes "1024x768" "800x600"
EndSubsection
EndSection
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></BLOCKQUOTE
><P
>&#13; Note the use of <SPAN
CLASS="QUOTE"
>"Identifiers"</SPAN
> here. Diego is starting two
separate <SPAN
CLASS="QUOTE"
>"displays"</SPAN
> here. Then he can choose which one he
wants when he logs in.
</P
><P
>&#13; Most display managers are derived from XFree86's venerable
<B
CLASS="command"
>xdm</B
>, and add their own enhancements. Let's look at the
most popular ones briefly.
</P
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN502"
></A
>3.2.1. xdm</H3
><P
>&#13; <B
CLASS="command"
>xdm</B
> can be configured with configuration files located in
<TT
CLASS="filename"
>/etc/X11/xdm/</TT
>,
<TT
CLASS="filename"
>/usr/X11R6/lib/X11/xdm</TT
>, or similar locations depending
on your system. These are system wide files. The file
<TT
CLASS="filename"
>xdm-config</TT
> is the main configuration file, and mostly
describes where to find secondary configuration files:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
! $XConsortium: xdm-conf.cpp /main/3 1996/01/15 15:17:26 gildea $
DisplayManager.errorLogFile: /var/log/xdm-errors
DisplayManager.servers: /etc/X11/xdm/Xservers
DisplayManager.accessFile: /etc/X11/xdm/Xaccess
! All displays should use authorization, but we cannot be sure
! X terminals will be configured that way, so by default
! use authorization only for local displays :0, :1, etc.
DisplayManager._0.authorize: true
DisplayManager._1.authorize: true
! The following three resources set up display :0 as the console.
DisplayManager._0.setup: /etc/X11/xdm/Xsetup_0
DisplayManager._0.startup: /etc/X11/xdm/GiveConsole
DisplayManager._0.reset: /etc/X11/xdm/TakeConsole
!
DisplayManager*resources: /etc/X11/xdm/Xresources
DisplayManager*session: /etc/X11/xdm/Xsession
!
! SECURITY: do not listen for XDMCP or Chooser requests
! Comment out this line if you want to manage X terminals with xdm
DisplayManager.requestPort: 0
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; The <SPAN
CLASS="QUOTE"
>"!"</SPAN
> denotes comments. The command that starts the X server
is in <TT
CLASS="filename"
>/etc/X11/xdm/Xservers</TT
> in this particular example
as defined by <SPAN
CLASS="QUOTE"
>"DisplayManager.servers"</SPAN
>, and is the equivalent to
<TT
CLASS="filename"
>xserverrc</TT
> that was used for <B
CLASS="command"
>startx</B
> X
server start up commands, but the syntax is slightly different here. The
contents of <TT
CLASS="filename"
>/etc/X11/xdm/Xservers</TT
> on my system are simply:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
:0 local /usr/X11R6/bin/X
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; This starts <SPAN
CLASS="application"
>X</SPAN
> on the first local display
(designated by 0). Any special command line arguments that you want to add go
here at the end.
</P
><P
>&#13; Below is a sample <TT
CLASS="filename"
>/etc/X11/xdm/Xsetup_0</TT
> which is
used to configure the log-in screen only. Notice that we're using a shell
script here, and it's calling <B
CLASS="command"
>xv</B
> (a graphics display
program) to set the background to a nice image (instead of the boring black
and white background pattern), and if that fails,
<B
CLASS="command"
>xsetroot</B
> is then invoked to at least try to set the
background to a nicer blue color. This does not configure the login widget
itself -- just other things that might be wanted on the screen during login.
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
#!/bin/sh
xconsole -geometry 480x100-0-0 -daemon -notify -verbose -fn \
'-schumacher-clean-medium-r-*-*-10-*-*-*-*-*-*-*' -exitOnFail &#38;
/usr/X11R6/bin/xv -quit -root /usr/share/pixmaps/Backgrounds/InDreams.jpg \
|| xsetroot -solid darkblue
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; <TT
CLASS="filename"
>/etc/X11/xdm/Xresources</TT
> controls the X
<SPAN
CLASS="QUOTE"
>"resources"</SPAN
> used during log in. In this context, <SPAN
CLASS="QUOTE"
>"resources"</SPAN
>
are user preferences for such items as fonts and colors (described in more
detail below). Below is a snippet that sets up fonts for the log-in widget:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
#if WIDTH &#62; 800
xlogin*greetFont: -adobe-helvetica-bold-o-normal--24-240-75-75-p-138-iso8859-1
xlogin*font: -adobe-helvetica-medium-r-normal--18-180-75-75-p-103-iso8859-1
xlogin*promptFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1
xlogin*failFont: -adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1
#else
xlogin*greetFont: -adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso8859-1
xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-69-iso8859-1
xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-69-iso8859-1
xlogin*failFont: -adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859-1
#endif
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; As you can see this is using helvetica as the preferred font, with different
point sizes and dots per inch depending on the screen size. This is
customizable to suit individual needs. (See below for more on understanding X
font naming conventions.) Various other aspects can similarly be configured.
</P
><P
>&#13; <TT
CLASS="filename"
>/etc/X11/xdm/Xsession</TT
> is the rough equivalent to
<TT
CLASS="filename"
>xinitrc</TT
> for <B
CLASS="command"
>startx</B
>. It will similarly
set up a default environment for keyboard, etc. And can also start either
<SPAN
CLASS="application"
>KDE</SPAN
> or <SPAN
CLASS="application"
>GNOME</SPAN
>, and other
<SPAN
CLASS="application"
>X</SPAN
> client programs. This is the system wide
configuration file. It should also check the user's home directory for
<TT
CLASS="filename"
>~/.xsession</TT
>, and possibly
<TT
CLASS="filename"
>~/.Xclients</TT
>, which would contain the user's preferred
environment and start up programs, just as <TT
CLASS="filename"
>~/.xinitrc</TT
>
did with <B
CLASS="command"
>startx</B
>. Again, the files in a user's home
directory may be created or modified by the user any time and must be
executable shell scripts.
</P
><P
>&#13; We shall not include an <TT
CLASS="filename"
>~/.xsession</TT
> example here, since it
would be very similar to the <TT
CLASS="filename"
>~/.xinitrc</TT
> and
<TT
CLASS="filename"
>~/.Xclients</TT
> examples above.
</P
><P
>&#13; We've looked only briefly at the main <B
CLASS="command"
>xdm</B
> configuration files.
Be sure to read the man page, and look at what is installed locally, for more
information. Let's look now at <B
CLASS="command"
>gdm</B
> and <B
CLASS="command"
>kdm</B
>.
We'll just highlight significant differences, since they essentially provide
the same functionality.
</P
></DIV
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN554"
></A
>3.2.2. gdm</H3
><P
>&#13; <B
CLASS="command"
>gdm</B
> is the default display manager for
<SPAN
CLASS="application"
>GNOME</SPAN
>. <B
CLASS="command"
>gdm</B
> was written
from scratch, but functions similarly to <B
CLASS="command"
>xdm</B
>. The main
configuration file is <TT
CLASS="filename"
>gdm.conf</TT
>, typically located as
<TT
CLASS="filename"
>/etc/X11/gdm/gdm.conf</TT
>. This is quite different looking
than <TT
CLASS="filename"
>xdm-config</TT
>. Comments are denoted with a
<SPAN
CLASS="QUOTE"
>"#"</SPAN
>, and the file has sections, with section headers enclosed
in square brackets. The command to start <SPAN
CLASS="application"
>X</SPAN
> is in
the <SPAN
CLASS="QUOTE"
>"[servers]"</SPAN
> section:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
[servers]
0=/usr/bin/X11/X
#1=/usr/bin/X11/X
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; Notice this has potentially two displays set up, but the second one is
commented out. Add any additional <SPAN
CLASS="application"
>X</SPAN
> startup
options here, e.g. <SPAN
CLASS="QUOTE"
>"-dpi 100"</SPAN
>. The log-in screen and log-in
widget are configured in the <SPAN
CLASS="QUOTE"
>"[greeter]"</SPAN
> section.
</P
><P
>&#13; Start up clients and programs are determined by the <SPAN
CLASS="QUOTE"
>"SessionDir"</SPAN
>
statement in the <SPAN
CLASS="QUOTE"
>"[daemon]"</SPAN
> section. On my installation, this
points to <TT
CLASS="filename"
>/etc/X11/gdm/Sessions/</TT
>, which contains several
short scripts. If I look at my <TT
CLASS="filename"
>Default</TT
> script, it
actually executes <TT
CLASS="filename"
>/etc/X11/xdm/Xsession</TT
>, which in turn
would execute <TT
CLASS="filename"
>~/.xsession</TT
>, if present. So at this final
stage, <B
CLASS="command"
>gdm</B
> acts very much like <B
CLASS="command"
>xdm</B
>.
</P
><P
>&#13; <SPAN
CLASS="application"
>GNOME</SPAN
> includes the <B
CLASS="command"
>gdmconfig</B
>
utility to control many aspects of <B
CLASS="command"
>gdm</B
> behavior.
</P
></DIV
><DIV
CLASS="sect3"
><H3
CLASS="sect3"
><A
NAME="AEN586"
></A
>3.2.3. kdm</H3
><P
>&#13; <B
CLASS="command"
>kdm</B
> is the display manager from <SPAN
CLASS="application"
>KDE</SPAN
>.
The main configuration file for <B
CLASS="command"
>kdm</B
> is
<TT
CLASS="filename"
>kdmrc</TT
> and is typically installed
as <TT
CLASS="filename"
>/etc/kde/kdm/kdmrc</TT
>. As is the case with
<TT
CLASS="filename"
>gdm.conf</TT
>, <TT
CLASS="filename"
>kdmrc</TT
> uses
<SPAN
CLASS="QUOTE"
>"#"</SPAN
> for comments, and has sections with section headers in
similar square brackets. <B
CLASS="command"
>kdm</B
> configuration can also be
edited with the <B
CLASS="command"
>kcontrol</B
> utility.
</P
><P
>&#13; The visible desktop is configured in the <SPAN
CLASS="QUOTE"
>"[Desktop*]"</SPAN
>
section(s), and by the <SPAN
CLASS="QUOTE"
>"Setup"</SPAN
> directive which should point to a
file like <TT
CLASS="filename"
>/usr/share/config/kdm/Xsetup</TT
> or
<TT
CLASS="filename"
>/etc/X11/xdm/Xsetup_0</TT
>. This will accomplish the same
thing as <B
CLASS="command"
>xdm</B
>'s <TT
CLASS="filename"
>Xsetup_0</TT
> does: namely
running any programs the user might want such as <B
CLASS="command"
>xconsole</B
>.
</P
><P
>&#13; The command to launch the X server is the <SPAN
CLASS="QUOTE"
>"Xservers"</SPAN
> directive
in the <SPAN
CLASS="QUOTE"
>"[General]"</SPAN
>. Again, this should point to a file such as
<TT
CLASS="filename"
>/etc/X11/xdm/Xservers</TT
>, and uses the same syntax as
<B
CLASS="command"
>xdm</B
>:
</P
><P
>&#13; <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;
:0 local /usr/X11R6/bin/X
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>&#13; Any command line options for the X server, go here.
</P
><P
>&#13; The login widget itself is configured in the <SPAN
CLASS="QUOTE"
>"[X-*-Greeter]"</SPAN
>
section(s). Compiled in defaults are used if the user does not specify any.
</P
><P
>&#13; <SPAN
CLASS="application"
>KDE</SPAN
> includes the <B
CLASS="command"
>kdmdesktop</B
>
utility to control some aspects of <B
CLASS="command"
>kdm</B
> behavior, mostly
just the login background.
</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="xfree86.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="moreconfig.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>XFree86</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>More X Configuration</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>