9.4.5 X sessions
An X session (X server + X client) can be started by:
-
startx
: wrapper script command for xinit
to start an
X server and client from a Linux character console. If ~/.xinitrc
does not exist, /etc/X11/Xsession
is executed through
/etc/X11/xinit/xinitrc
.
-
xdm
, gdm
, kdm
, or wdm
: X
display manager daemons to start the X server and client, and to control login
via a GUI screen. /etc/X11/Xsession
is directly executed.
The console can be made available as in "Let me disable X on boot!",
Section 8.1.4.
9.4.5.1 Custom X sessions
The default startup script /etc/X11/Xsession
is effectively a
combination of
/etc/X11/Xsession.d/50xfree86-common_determine-startup
and
/etc/X11/Xsession.d/99xfree86-common_start
.
Execution of /etc/X11/Xsession
is somewhat affected by
/etc/X11/Xsession.options
and is essentially an execution of a
program which was first found in the following order with the exec
command:
~/.xsession
or ~/.Xsession
, if it is defined.
/usr/bin/x-session-manager
, if it is defined.
/usr/bin/x-window-manager
, if it is defined.
/usr/bin/x-terminal-emulator
, if it is defined.
The exact meaning of these commands is determined by the Debian alternative
system described in
Alternative
commands, Section 6.5.3. For example:
# update-alternatives --config x-session-manager
... or
# update-alternatives --config x-window-manager
In order to make any X window manager a default while keeping GNOME and KDE
session managers installed, replace
/etc/X11/Xsession.d/50xfree86-common_determine-startup
with the
one attached in the second bug report at https://bugs.debian.org/168347
(I hope this will be included soon) and edit
/etc/X11/Xsession.options
as follows to disallow the X session
manager:
# /etc/X11/Xsession.options
#
# configuration options for /etc/X11/Xsession
# See Xsession.options(5) for an explanation of the available options.
# Default enabled
allow-failsafe
allow-user-resources
allow-user-xsession
use-ssh-agent
# Default disabled (enable them by uncommenting)
do-not-use-x-session-manager
#do-not-use-x-window-manager
Without the above mentioned modification to the system,
gnome-session
and kdebase
are the packages containing
these X session managers. Removing them allows X window manager to be a
default. (Yack, any better idea?)
On a system where /etc/X11/Xsession.options
contains a line
allow-user-xsession without preceding characters, any user who
defines ~/.xsession
or ~/.Xsession
will be able to
customize the action of /etc/X11/Xsession
.
The last command in the ~/.xsession
file should use form of
exec some-window/session-manager to start your favorite
X window/session manager.
A good example of an ~/.xsession
script is given at
/usr/share/doc/xfree86-common/examples/xsession.gz
.
I use this to set the window manager, screen access, and language support for
each user account. See
Starting an X session for a
user, Section 9.4.5.2,
Getting root in X, Section
9.4.12, and
Example for a multilingual X window system,
Section 9.7.9.
If you wish to have several X client programs started automatically, see X clients, Section 9.4.4 examples and invoke them from
~/.xsession
instead of ~/.xinitrc
.
User-specific additional X resources can be stored in
~/.Xresources
. See
X resources, Section
9.4.10.
User-customized keymaps and pointer button mappings in X can also be specified
in the user's start up script. See
Keymaps and pointer
button mappings in X, Section 9.4.11.
9.4.5.2 Starting an X session for a user
Following the principle described at
Custom X sessions,
Section 9.4.5.1, a user-specific X session/window manager can be activated
by installing the package indicated and setting the contents at the end of
~/.xsession
file as follows. (I like
blackbox
/fluxbox
for its simple style and fast
speed.):
See
Window Managers for X
.
9.4.5.3 Setting up KDE and GNOME
In order to setup full KDE or GNOME environment, the following metapackages are
useful:
Installing these packages with tools which handle Recommends, such
as dselect
and aptitude
, provides you with richer
choices of software than just installing these with apt-get
.
If you want console login, be sure to disable X display managers, such as
kdm
, gdm
, and wdm
, which may be pulled
in by the dependencies, as described in "Let me disable X on boot!",
Section 8.1.4.
If you want to have GNOME as the system default over KDE, make sure to
configure x-session-manager
as in Alternative commands, Section
6.5.3.