[RHCE] x session information
Frank Pittenger
rhce@trilug.org
Fri, 23 Aug 2002 12:39:40 -0400 (EDT)
---559023410-1804928587-1030120780=:16449
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
I am attaching a soft copy (with a couple of corrections) of the information
passed out at Tuesday's talk.
Frank
---559023410-1804928587-1030120780=:16449
Content-Type: MESSAGE/rfc822; name=xtalk
Content-Description: xtalk
X Window System
The X Window System (X) is a network-based graphics windowing system
developed by MIT. It is the industry standard windowing system in the
Unix/Linux world. The current distribution is Version 11, Release 6
(X11R6). X provides the bare bones of a window system upon which almost
any style of graphical user interface (GUI) can be built.
X does not impose any particular look and feel. Many window managers are
available, each with their own look and feel.
X is not required for the Linux operating system to run, it is a layered
application.
Unlike Microsoft Windows, with Linux the operating system, window system,
and window manager are three separate things.
X-Server
The X-server gets input from the keyboard and the mouse and draws images on
the monitor.
Red Hat uses XFree86. Other commercial X distributions are available. There
are also commercial drivers for certain graphics cards.
X-Clients
X-clients are the applications that run in the X environment. The tell the
X-server when they are interested in keyboard or mouse input, and tell the
X-server when they have output to draw on the display.
The window manager is an X-client.
X-clients can run locally or remotely.
Configuration
Before installing, Check to see if your hardware is supported:
http://www.redhat.com/support/hardware/index.html
http://www.xfree86.org/cardlist.html
for laptops:
http://www.linux-laptop.net
The configuration program Xconfigurator is run during installation, and can be
run stand-alone subsequent to installation. Xconfigurator can't be run in
runlevel 1 (single user mode). It should be run from runlevel 3 (multiuser
without X). To do this from another runlevel:
init 3 (go to multiuser mode, no X)
Xconfigurator
init 5 (go to multiuser with X)
XFree86 has another configuration tool, XF86Config, but Xconfigurator is the
preferred tool.
You can also edit files manually:
/etc/X11/XF86Config-4
or:
/etc/X11/XFree86Config
depending on yourXFree86 version.
To probe for hardware that Xconfigurator can't figure out, run:
SuperProbe
Checking Versions:
XFree86 version:
rpm -qa | grep XFree86
X-server version:
ls -l /etc/X11/X
This is symbolically linked to the X-server version you are running.
Startup
To start just the X-server (no window manager, just for fun) enter: X&
To start X with a window manager, enter: startx
startx is a shell script located in /usr/X116/bin which calls xinit.
You should have an .xinitrc file in your home directory. You should have
a line in this file for each application you want on your desktop at startup.
Each application should be backgrounded except the final entry which should
be your window manager, e.g.
xterm -cb&
xterm -cb&
xclock&
exec fvwm
If you don't have a ~/.xinitrc file, startx will run the file:
/etc/X11/xinit/xinitrc which will run ~/.Xclients or
/etc/X11/xinit/Xclients.
To make X start by default, edit /etc/initab and change the number in the
"initdefault" line to "5."
You can also change your default runlevel with linuxconf.
When starting in runlevel 5, a display manager will appear for you to login.
By default, you will get the display manager for the desktop you chose, gdm
for the gnu desktop or kdm for the kde desktop. You can change the display
manager by editing /etc/X11/prefdm. Change preferred=xxx to your choice of
gdm, xdm or the no-nonsense xdm.
The display manager is responsible for:
deciding whether you access the system graphically
authenticating you by accepting your username and password
starting the correct graphical environment based on your preferences
When booting in runlevel 5, the display manager launches a session manager,
/usr/bin/gnome-session for gnome, /usr/bin/kwm for kde or /usr/bin/xsession
for the standard X session manager. In this case, .xinitrc is not run.
xsession checks for session customization in ~/.xsession or ~/.Xclients.
Window Managers
A window manager is a special X-client. There are several you can choose from.
You can use the switchdesk utility to switch between desktop environments.
switchdesk creates a .Xclients and a .Xclients-default file in your home
directory and renames an existing .Xclients file to .Xclients.switchdesk.
Remote X
When you run an X-client application remotely, you tell the remote system to
use your local display, and then run the application on the remote system.
The application will recieve keyboard and mouse input from your local X-server
and will send display output to your X-server. Before the remote system can
have access to your local display, you must give permission on your local
X-server.
The "basic" X security command is xhost. Entering xhost shows the current
security settings.
xhost +
disables all security and allows connections from any system. Anyone who can
reach your computer can display an application on your screen.
xhost -
keeps any other machine/user from using your X-server.
xhost +server.xxx.com
allow connection from server.xxx.com
xhost -server.xxx.com
disable future connections from server.xxx.com
To run the xfoo program (X-client) on buzz, and interact with it when you are
on ding (X-server):
1) open an xterm on ding
2) enter the command: xhost +buzz
3) telnet buzz
4) foo -display ding:0.0 &
To keep from entering the display of ding for each client you run on buzz,
you can set buzz to display on ding. From bash, sh, ksh:
export DISPLAY=ding:0.0
from csh or tcsh:
setenv DISPLAY ding:0.0
now on buzz, you can just enter foo& and the foo app will appear on ding.
Stronger X access control is provided by the xauth program which uses the file
~/.Xauthority. xauth will allow you to set a magic cookie on your remote
account such that your X server will recognize it as being eligible to access
your X server. First, as the localuser who is running X type in an xterm:
xauth list $DISPLAY
which will output the xauth cookies associated with your current
display. It should look something like:
yourhostname/unix:0 MIT-MAGIC-COOKIE-1 f00004739672dece010d7e1faf01dca9
(note, the magic cookie has been changed to protect the innocent).
Then in the remote xterm type:
xauth add $DISPLAY . f00004739672dece010d7e1faf01dca9
(please note the big long number matches the one above).
Now logged in as the user on the remote system, you can access the local
X-server and display X apps. Since the remote user is caching the magic cookie
in the .Xauthority file in the remote user's homedir, the remote user will be
able to display on this X server instance as long as it keeps running.
Troubleshooting and Common Problems
If X starts and you get a blank or garbled screen, Ctrl+Alt+Backspace should
kill the X server. Boot the system to runlevel 3 and run Xconfigurator.
If you need a newer version of Xfree86, you can look for it under your Red Hat
system level at:
http://www.redhat.com/support/errata/
An upgrade howto is available at:
http://www.redhat.com/support/resources/howto/XFree86-upgrade/XFree86-upgrade.html
If you see a flash of error messages when X is starting, you can enter the
command:
X -probeonly >& foo
to create a file with the complete error message.
You can also chaeck for errors logged to:
~/.xsession-errors
/var/log/messages
/var/log/Xerrors
Files like ~/.xinitrc, ~/.Xsession, ~/.Xclients can get messed up. You can
rename them and take system defaults to see if this resolves a problem.
Make sure /usr/X11R6/bin is in your PATH.
Make sure your DISPLAY variable is set correctly.
Hints/Tips
If you configure your X-server to support multiple video modes, you can switch
between them with CTRL+ALT++ (from the keypad) or CTRL+ALT+- (from the keypad).
This can be hard to do on notebooks.
You can also switch between your X display and text mode virtual consoles,
press CTRL+ALT+F1 (F1-F6). To switch back to X, press ALT+F7.
Be familiar with the /etc/X11 and /usr/X11R6 directories.
You can set X-client options in your ~/.Xdefaults file to avoid having
to specify the options on the command line.
! XTerm
XTerm*background: #0000bd
XTerm*foreground: white
XTerm*font: 8x13bold
XTerm*font3: 7x13bold
XTerm*font4: 7x14bold
XTerm*font5: 9x15bold
XTerm*font6: 10x20
XTerm*saveLines: 10240
!XTerm*saveLines: 32000
XTerm*cursorColor: orange
XTerm*pointerColor: orange
XTerm*scrollBar: True
XTerm*jumpScroll: True
XTerm*scrollKey: True
!not-colon XTerm.VT100.charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48
XTerm.VT100.charClass: 33:48,35:48,37:48,43:48,45-47:48,58:48,64:48,95:48,126:48
XTerm.VT100.reverseWrap: True
XTerm*ttyModes: erase ^H
To get .Xdefaults settings to take effect, enter:
xrdb -load ~/.Xdefaults
You can also customize X with these setting utilities, if your window manager
does not override the settings:
xset - this command allows you to set your font search path, screensaver,
bell settings and mouse motion preferences. e.g. xset s off turns off the
screensaver.
xsetroot - sets the root window color, e.g. xset -solid royalblue3
X Programming
X programming can be done at a number of levels. The base level is the
protocol level. Few people ever need to program at this level.
The next level is the Xlib interface level. This is low level graphics calls
for making lines, boxes, geometric shapes, and performing graphical operations
such as layering and combining graphical objects. Sophisticated programs can
be written at this level (e.g. xv) and you will know a lot about X when you
are done!
The next level is the Xt intrinsics level. Xt is the basic X toolkit for
creating basic GUIs. It includes a free widget set called the Athena widgets.
Motif and other toolkits are above the Xt layer. Motif programs may sometimes
make direct Xt calls and infrequently make Xlib calls. To compile a Motif
program, you need the Motif, Xt, and Xlib include and lib files.
Motif
Motif is a toolkit (set of widgets). There is also a Motif Window Manager.
Many aaplications were written using the Motif toolkit (such as NCSA Mosaic,
Netscape). The Motif run time libraries have been free, but until recently,
the development environment has not been.
Open Motif: http://www.opengroup.org/openmotif/
Open Motif, is a source code version of Motif, available under a public
license, the effect of which allows Open Motif to be distributed, royalty free,
when the platform upon which it is shipped is Open Source.
Read the faq for clarifications on the license... such as why Open Motif does
not meet the Open Source definition.
The existing commercial release of Motif continues to be available for non-Open
Source distribution, full details of the license and pricing information is at:
http://www.opengroup.org/motif
LessTif: http://www.lesstif.org/
LessTif is the Hungry Programmers' version of OSF/Motif. It aims to be
source compatible meaning that the same source code should compile with both
and work exactly the same!
LessTif is "free software": it is licensed under the GNU Library General
Public License (LGPL).
---559023410-1804928587-1030120780=:16449--