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.
  1. Log on using the personal account created for you: lastnamef
    (Your password is initially configured to be the same as your logname).
  2. 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
  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.
  1. 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.
  2. 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.
  3. Type the command exit in the xterm window.
  4. 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
  5. 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!
  6. 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.
  7. 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.
  1. 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
  2. Save the file and give it execute permission.
  3. Now re-excute the xinit command
    This may be a little better, but let's add a simple window manager to the picture.
  4. Type exit in the xterm window to return to your shell.
  5. Edit your .Xclients file to look like the following:
    xclock -geometry 100x100-5+5 &
    xterm -geometry 80x24+50+150 &
    exec twm
  6. 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.
  7. 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.
  8. Now add the following line just above the exec line in the .Xclients file:
    mozilla &
  9. 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?
  1. Look in the directory: /usr/X11R6/bin for various clients you might want to run.
  2. You don't need to stick with twm as the window manager.
    Try using mwm, the Motif Window Manager.
  3. Check out the xsetroot command for playing with the background of the desktop.
  4. 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.
  5. 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.
  1. 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!!!!
  2. This command will create an image file called lab3 in your current working directory.
  3. 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.