Using Xwindows in W109

Xwindows, which is more commonly referred to as just X is a graphical rendering system which was originally designed for UNIX-based systems. Our Linux systems run a version of X, and an MS-Windows-based version called Xwin32 is available on most, if not all, of the Windows machines on campus.

There are really two or three parts to an Xwindows system. First, there is the X server. Its job is to receive and execute requests for graphics actions from applications programs. That is, its job is to control the screen and write stuff to it for the applications. So if an application wants a window drawn on the screen, it sends a message to the server asking it to draw the window.

Separating the applications from the X server allows them to run on different machines. Normally, the server is started on the machine you are sitting at (the local machine). The application can then be on the local machine or some other machine, called a remote machine.

This means that if you are sitting in front of machine a, which has an X server running, and you have an account on another machine (which understands X), then you can run X applications on the remote machine while interacting with it locally.

X also allows various window managers to be used. The X server itself is a very low-level interface. It does not provide any kind of shell for the user to provide commands, and it also does not perform any kind of applications work. It simply takes requests from programs and tries to execute them. To make use of the Xwindows system, we humans need an intermediary. This is what the window manager is for.

The window manager provides a method for us to open windows, move them around, and close them. It also provides a method to send mouse clicks, keyboard key strikes, etc., to the applications running in the windows. The environment we use on the Linux machines in W109 is called KDE which is a free version of the Common Desktop Environment, CDE. When you start X windows in W109 (by typing startx, KDE and its window manager get started by default. Xwin32 essentially acts like a window manager/server that runs in the MS-Windows environment (I don't use it, so I don't really know how to start it).

Because these two systems use different window managers, they will look and feel different when you go to use them. This makes it hard for me to explain every last detail about how they work. In lieu of doing this, I will instead just explain some basic things and let you play.

Depending on the window manager, you will see different things when you start X. The simplest thing you might see is just a screen with a blank or patterned background and a cursor that looks like a big 'X'. What you are looking at is the root window. If you start clicking mouse buttons, you will (hopefully) see some menus that will let you do things like open other windows.

The KDE environment will display a background image, put some icons in the root window, and place a panel at the bottom of the screen. It may do some other things depending on how it is configured. Oh, it will also start a configuration program the first time it runs.

Regardless of the window manager used, there a some basic applications that you should know about. The first is xterm. xterm is a application that opens a window in the root window and starts a command-line interpreter in it. You can type all the usual UNIX commands such as ls and man as well as start applications by typing their names. Your window manager should provide a menu option or a panel icon which starts an xterm or its equivalent. If you are running KDE, look for an icon on the panel shaped like a screen with a small prompt and a seashell on top of it. Click on that icon to start a Konsole, which is a type of X terminal. Move the mouse cursor, called the pointer, into the window, then type xeyes and <Enter>. You may need to click on the window first to get it to accept commands (This is called "focusing"). xeyes will open another window... Well, you'll see what it does. Type control-C in the xterm to kill xeyes, or do a control-Z, followed by bg to run xeyes in the background and give you a new prompt.

All right, you should be able to start/run your favorite editor from here, so I'll just tell you how to quit X and let you go to it. To quit X, you can do Ctrl-Alt-Backspace. This should always work, but the window managers don't always deal with this very well, so you may want to shut them down gracefully first. Again, I don't know about Xwin32, but for KDE there is an icon that looks like a big 'K' on top of a gear. Click on this icon. Now click on the word "logout". This will shut down KDE and the X server. It will return you to a command prompt if you started X by hand, or will log you out of the system entirely if you logged into a machine already running X (such as the ones in the collabrative learning lab). This is an important point, if you started X by hand, the menu item "logout" doesn't log you out, it only shuts down X. Don't leave the machine without first logging out of the system!