Lab 3: Configuring an X Window Session
The purpose of this lab is to custom configure an X Window session for a regular user.
You will be editing configuration files to control
which window manager and which X clients will come up in the session.
You will then be turning in a screen shot of your configured display
along with the contents of one of the configuration files.
Step One
Boot the computer up to runlevel 3.
- Log on using the personal account created for you: lastnamef
(Your password is initially configured to be the same as your logname).
- X Windows should not be running; if it is, you need to switch to runlevel 3. Use the following command as superuser:
/sbin/init 3
- In your home directory, remove any hidden files called .xinitrc
or .Xclients
Step Two
To run an X Window Desktop session you would use the startx
command. In this lab, we are going to run a simpler version of the X
Window system consisting of just the X server, a window manager and a few clients.
- Try the command xinit and see what comes up.
Pretty simple, isn't it? You should have an xterm window in which you
may type various Linux commands. Note that without a window manager, the desktop
is not very user friendly.
- Type the command ps -u <logname> in the xterm window.
Note: Make sure the xterm window has input focus by clicking in the window with the mouse.
The ps output shows you what processes are running in your session.
- Type the command exit in the xterm window.
- You should now be back to your command line shell. What you just saw was the
bare-bones, no frills xinit command. For a more user friendly interface,
copy the system xinitrc file to your home diretory and rename it to .xinitrc.
cp /etc/X11/xinit/xinitrc .xinitrc
- Now enter the xinit command again.
Your screen should look like you just ran startx. What a difference can
be made with the right configuration file!
- Bring up a terminal window by clicking on the terminal icon in the taskbar at
the bottom of the screen. Enter the same ps command as you did above:
ps -u logname
Note how many processes (and resources) are being used in a full desktop session.
- Logout from the desktop back to your command line.
Step Three
We are now going to customize our own personal desktop, specifying which clients
we want to run in a configuration file called .Xclients. Note: .Xclients
is a hidden file.
- Use vi to edit a file named .Xclients in your home directory,
and add the following two lines to it:
xclock -geometry 100x100-5+5 &
exec xterm -geometry 80x24+50+150
- Save the file and give it execute permission.
- Now re-excute the xinit command
This may be a little better, but let's add a simple window manager to the picture.
- Type exit in the xterm window to return to your shell.
- Edit your .Xclients file to look like the following:
xclock -geometry 100x100-5+5 &
xterm -geometry 80x24+50+150 &
exec twm
- Notice that the command exec is used only once - on the last line of
the file. This means that your X session will not end until you exit from that
particular client.
- Rerun xinit
This is getting a little better. Play around with this simple window manager.
To exit the window manager, and the session, click in the desktop area and choose
exit from the pop-up menu.
- Now add the following line just above the exec line in the .Xclients file:
mozilla &
- Re-run the xinit command.
Step Four
You should be getting the idea here that the .Xclients file is a way for you to
customize your desktop session by deciding which clients you want started up.
You should always exec a window manager as the last line in the file. Why is that?
- Look in the directory: /usr/X11R6/bin for various clients you might
want to run.
- You don't need to stick with twm as the window manager.
Try using mwm, the Motif Window Manager.
- Check out the xsetroot command for playing with the background of the
desktop.
- Your task is to come up with a unique, custom X session that has a window manager
and at least three clients, one of which is an xterm window displaying the contents
of your .Xclients file.
- I placed some jpg image files you can load for a root window in the /home/images
directory. These can be loaded with the xsetbg command.
Step Five
When you are finished designing your desktop, you must take a screen shot of it
using the X Window Dump xwd command.
- From your xterm window, issue the following command:
xwd -root -out lab3
Be sure the contents of your .Xclient file is displayed in the xterm window!!!!
- This command will create an image file called lab3 in your current
working directory.
- If you would like to view the image you just created, you can do so with
the following command:
xwud -in lab3
To turn in
Compress your lab3 file using the gzip command:
gzip lab3
Now copy the lab3.gz file to the CIS191 account on opus.cabrillo.cc.ca.us using the following command:
scp lab3.gz CIS191@opus.cabrillo.cc.ca.us:lab3.logname
Note: you do have access to opus from the lab in room 2504.