X Window System
Basic concepts
-
X uses a client/server model, with an X server
and client applications such as browsers, editors, etc
-
The client's usually run the same machine as the server
but could be anywhere in the network
-
(From Wikipedia)
-
X is old: over 30 years. Some distros are replacing it
with Wayland
-
Note: many of the files or their contents keep
changing as distros evolve
Starting X
-
You get the most control by running Linux in runlevel 3
instead of runlevel 5. Set this in Fedora by establishing
links as decribed in
/etc/inittab
-
In Ubuntu, edit
/etc/default grub
and change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"
Then run
sudo update-grub
(http://www.cebuntu.com/how-to/how-to-boot-your-ubuntu-desktop-in-terminal-mode/)
-
Once logged in, run
X
to get just
an X server running
-
Run an X server plus an
xterm
by
starting xinit
-
Run a window/desktop manager by
startx
-
As root, run a display manager (which controls logins) by
gdm
(for Gnome display manager),
kdm
(for KDE display manager),
wdm
(for Wings display manager)
lightdm
(for Ubuntu 11.10 display manager)
or xdm
(the original X display manager)
X libraries
-
The basic library for clients is Xlib. This allows you to
build applications such as xterm, xclock, etc
-
The first O/O application library was Xaw (Athena widgets)
which is used to build e.g. xedit
-
Other early libraries are Motif and Tk
-
Modern libraries include Qt (for KDE) and GTK+ (for Gnome)
-
All these different client-side libraries have different
appearances, interaction styles and configuration
mechanisms e.g. a KDE client doesn't know about
the Gnome gconf system
xinit
Startx
-
This is the more common way of starting X
-
It uses ~/.xinitrc as startup script if it exists
-
If it doesn't, it uses a system-wide startup script
/etc/X11/xinit/xinitrc
-
The script /etc/X11/xinit/xinitrc is different for
Fedora and Ubuntu
-
Ubuntu will execute user commands in ~/.xsessionrc
-
Fedora will execute user commands in ~/.Xclients
Window managers
A window manager controls many aspects of application windows on the
screen
-
Initial location - may be done automatically or left to the user
-
Movement and resizing of windows
-
Iconfication, restore and zoom
-
Window menus
-
Screen menus
Common window managers
-
TWM - very old and basic
-
Mwm - Motif and CDE
-
Metacity - default for Gnome
-
KWin - default for KDE
-
Compiz - lots of fancy effects such as Wobbly Windows
-
Matchbox - small footprint, for embedded systems
Desktops
-
A desktop is a window under the control of a window manager
-
It usually takes up the full screen and all other windows
sit "inside" it
-
As well as application windows it also supplies additional
windows such as a task bar; application startup menus;
a tool bar, and so on
-
Major ones are KDE and Gnome but there are also
Enlightenment, Blackbox, etc
-
Each desktop is usually built from an extensive library
which also supports inter-process communication,
audio/video handling, configuration tools etc
-
Major libraries for desktops are
Qt (for KDE) and GTK+ (for Gnome),
-
Other widget libraries include
Xaw (for Athena widgets) Motif/Lesstif
and XUL (for Firefox)
Fedora desktop choice
-
startx
reads ~/.xinitrc or /etc/X11/xinit/xinitrc
-
For Fedora 16 the default is (simplified)
if [ -f $HOME/.Xclients ]; then
exec $HOME/.Xclients || \
elif [ -f /etc/X11/xinit/Xclients ]; then
exec /etc/X11/xinit/Xclients || \
fi
-
/etc/X11/xinit/Xclients contains
GSESSION=gnome-session
STARTKDE=startkde
# check to see if the user has a preferred desktop
PREFERRED=
if [ -f /etc/sysconfig/desktop ]; then
. /etc/sysconfig/desktop
if [ "$DESKTOP" = "GNOME" ]; then
PREFERRED="$GSESSION"
elif [ "$DESKTOP" = "KDE" ]; then
PREFERRED="$STARTKDE"
fi
fi
if [ -n "$PREFERRED" ]; then
exec "$PREFERRED"
fi
-
So
-
System-wide settings can be made in /etc/sysconfig/desktop
-
A user can override these in ~/.Xclients
-
on my system, ~/.Xclients says to run
startkde
Display manager
-
Using runlevel 3, Linux boots into text mode and you
get a login prompt. After login, you can start X by
startx
-
In runlevel 5, Linux boots into X. You then need to do
a graphical login
-
A display manager gives you a GUI login dialog and then
logs you in, setting USER, HOME etc
-
Common display managers are xdm, gdm (for Gnome) and
kdm (for KDE)
-
Ubuntu sets the default display manager in
/etc/X11/default-display-manager.
In Ubuntu 11.10 it is
lightdm
-
Fedora uses the value of DISPLAYMANAGER which you can set
in /etc/sysconfig/desktop
kdm
-
kdm is the display manager for KDE
-
Its configuration file is typically
/etc/kde3/kdm/kdmrc - rarely edited by you
gdm
-
gdm is the display manager for Gnome
-
The configuration file is /etc/gdm.conf - rarely edited
by you
Ubuntu
-
Most Unix/Linux systems use the runlevel to decide if they
run X or a text system
-
Debian/Ubuntu just treat X as yest another application
-
Debian/Ubuntu boot into runlevel 2
-
Ubuntu is in transition mode;
-
It has replaced Gnome with its own desktop Unity
-
While many distros are moving away from X to Wayland,
Ubunti has forked Wayland and will instead use Mir
EEE PC
The EEE PC is based on a Xandros distro. What does it use?
X servers
-
There are two major X servers, XFree86 and Xorg
-
The configuration files for both live in /etc/X11 as
XF86.conf or xorg.conf
-
Nowadays you rarely have to configure the servers yourself
-
There are a number of ways of generating a configuration file
such as
Xorg -configure
, XF86config
etc
Distributed X
Wayland
-
X is now over 20 years old, and PC hardware has changed a lot since then
-
The s/w model has also changed, with processing being moved from the X server
to X clients (e.g. wobbly windows can't be done by the server)
-
A new lightweight server is being developed, called Wayland
-
It is expected to replace X over the next few years...
-
... except for Ubunti which has its own replacement, Mir
-
Window managers, display managers, application libraries will all be
moved to Wayland/Mir so that users and most programmers won't notice
Conclusion
-
X is designed to implement the minimum needed in the
simplest way - so it just gives you a server
-
Clients talk to the server
-
A window manager handles clients - and there are many
different window managers
-
A desktop manager may handle desktop effects - and there
are several desktop managers
-
Fedora and Ubuntu/Debian have different ways of starting
X and the clients :-(
-
X is reaching "end of life" and will be replaced over the next few years