Basic UNIX 4: More on the GUI

Information Technology Services
Iowa State University

	In this module, we'll look at how X, the most graphical user interface for Linux and UN*X in general, works, and the various components involved. We'll find out about window managers and desktop environments, file managers, and how we do day-to-day management tasks and just a bit of system administration from the graphical desktop.
	Historically, UNIX started with text terminals connected to a central server machine. Later on, people wanted to do graphics, and X Windows (or just X) was developed to connect graphical terminals to the server machine. X requires two pieces: an X server and an X client. The X server machine (aka X terminal) draws graphics on a display from commands received over the network via TCP port 6000. The X client runs the application, which sends X commands to the X server. Nowadays, the X server and X client usually run on the same computer, but not necessarily!
	Here's a graphical representation of how it all works. The client application talks to the TCP/IP software stack, which sends commands to the server over the network. The server machine receives those commands and figures out how to draw the graphics the client is asking for. If the client and server are running on the same machine, the TCP/IP software knows that it doesn't have to put commands destined for “localhost” out on the network wire; it processes them internally.
	You might run applications remotely because: The software vendor wants to handle licensing by keeping the software on a single machine and letting workstations display the output. SAS 9.1 is like that. A small workstation (even diskless) can run software too large for it by displaying output from software run on another machine. The Linux Terminal Server Project uses this idea to get several workstations for the price of one: see www.ltsp.org for more info.
	X is normally insecure, and baddies can either snoop on your X session or display bad stuff on your machine. The “-X” option tells ssh to create a secure network tunnel for the normally insecure X protocol. Don't use “-x”; that's the flag that tells ssh not to allow X tunneling. [ Exercise: Open a shell window. At the shell prompt, type ssh -X netid@sas.iastate.edu where “netid” is your ISU NetID. Once logged in, type sas to start the SAS program. Close all the SAS windows and press <Ctrl/D> to log out. ]
	The window manager is the software responsible for drawing and positioning windows and other objects on the desktop and managing virtual desktops (if they're available). It may also handle creating menus, copy-and-paste and other niceties. KDE and the Gnome Desktop are very MS Windows-like, mostly because MS Windows is much like Motif, an earlier UNIX window manager. However, the window manager can be very much unlike Motif, as the following examples show.
AfterStep 2.0, an easily configurable window manager.	WindowMaker, a good choice for smaller machines (we'll see more of it later).
	A desktop environment goes beyond window management to include its own GUI system utilities, standard applications and other goodies. Microsoft Windows is really a desktop environment. KDE and Gnome Desktop are the most well-developed and popular desktop environments for Linux. [ Exercise: log in to the K Desktop Environment and examine some of the choices in the Accessories, Games, Graphics, Internet, Office and “Sound & Video” menus. Bear in mind that almost all of this software was installed from the Red Hat CDs and is included at no extra charge. ]
	If you're a system administrator, you'll have to get used to the fact that, within the limits you set, your users will have lots of choices of desktop appearance and behavior. Not only can they choose window manager, but they can choose themes that can make one machine look completely different from another maching running the same window manager. Of course, they can only do that if you allow them to install the window manager and/or themes. Since you have more control over that with Linux, you can be more restrictive if you want to.
	One reason for using a non-standard window manager is that modern desktop environments are resource hogs. Putting a smaller, lighter window manager (say, IceWM) can give a whole new lease on life to machines that you were going to send to surplus.
	And choices can make you more popular with your users as well. If they can select their native language and favorite window manager, that's a lot more harmless way of customizing the machine than installing insecure software from who knows where. And the right window manager/theme choice can let your (former) Windows users have a familiar look and feel without having to give them Windows.
FVWM with RedmondXP	FVWM with Redmond98
	There are several ways to select a window manager. We've already seen how to choose one from the Session menu, but you can also choose a default by modifying .Xclients (for your own default) or /etc/sysconfig/desktop (for a global default – you'll have to be root to modify that file).
	In this class, I'm going to emphasize the K Desktop Environment over some of the others. Why? Because it's probably the best choice for modern hardware. It's most popular, the system tools are better, and Konqueror is more stable than Gnome's Nautilus (especially when working with OpenAFS). The “Start Menu” in KDE is really called the K Menu, but because Red Hat puts their red hat icon on it instead of KDE's default K, we'll also call it the Start Application menu. Sorry for the confusion.
	Most modern window managers believe in the Windows <Alt/Tab> for switching windows, but not all, so you may have to try clicking on the window (or even the titlebar) if it doesn't work.
	For creating documentation or just capturing pictures it's useful to capture the graphic screen to a file. There used to be an application in RHEL to do that, but they left it out of the new version. Here's how you do it with GIMP, which does a better job anyway. [ Exercise: save a copy of any window on your screen. Start GIMP from the Graphics menu. Choose File > Acquire > Screen Shot Click OK, then in the window you want to save. Save the picture with File > Save As. ]
	[ Exercise: Select System Settings -> Date and Time Enter the root password Verify that the location is somewhere in the Central time zone Turn on Enable Network Time Protocol and select or enter “time.iastate.edu” as the server. Click Apply. ]
	[ Exercise: Move the KDE Panel to the right side of the screen. Make the icons Small or Tiny rather than Normal. ]
	When you install software, you'll probably want to put it in the K Menu (aka Start Applications menu – the theme Red Hat uses puts their Red Hat logo in the Panel instead of the default K). Some installers recognize the K Menu and do it for you, but not all of them. And your users will want to rearrange things anyway...
	[ Exercise: Start the Menu Editor. Right-click the Start menu icon and choose “Menu Editor”. Highlight “Accessories” and click “New Item”. For Item Name, enter “Gimp” and click “OK”. Under Command enter “gimp”. Click the blank icon at the right and pick one you like (there is one for Gimp). Choose File > Save. Verify that the item appears in the Accessories menu, and that it works. Close the Gimp windows. ]
	[ Exercise: Right-click on the Gimp item we just created and select “Cut”. Open the Graphics folder by clicking on the plus sign to the left. Right-click on “Office” and select “Paste”, then choose File > Save. Verify that Gimp now appears under “Office”. ]
	[ Exercise: Open a Konqueror window by choosing Home from the K Menu. If you can't see the .kde folder, choose View -> Show Hidden Files. Double-click on .kde to open it, then double-click on Autostart. Open another Konqueror window. Use the Up button to browse up to /, then down to /usr/X11R6/bin. Drag xclock from the /usr/X11R6/bin window to the .kde/Autostart window. Release the mouse button, then click “Link Here”. ]
	Many of the settings in the Control Center apply only to the user running CC. (Those settings will be stored in the .kde directory in your home directory.) Bear in mind that if a window has an “Administrator Mode” button in it, you will be changing those settings for all users, not just you, so you'll need the root password to do that. [ Exercise: Select “Control Center” from the K Menu (aka Start Applications menu). ]
	The Appearance and Themes section of Control Center governs how the Desktop looks. The Theme Manager allows a wide variation in appearance even within KDE itself. [ Exercises: Choose a background wallpaper. Examine the choices of screen saver (choose one, then click “Test”); pick “Random” when you're finished. Examine the styles available; switch from the Bluecurve style (the Red Hat default) to KDE Default ]
	[ Exercises: Set the left mouse button to open the application menu on desktop click. This is the default in WindowMaker; turn it off again. Set the number of virtual desktops to six, then back to four. Change the screen resolution to something smaller. Allow it to revert to the standard setting. Show the options in the Window Behavior menu. Under Moving, point out that slow machines benefit from turning off “Display content in...” ]
	You can use KDE (and many other window managers) without a mouse, but you have to turn it on in the Control Center (choose Mouse > Mouse Navigation > “Move pointer...”. Just press <Shift/NumLock> and use the numeric keypad keys to move the mouse pointer. The 5 key is the mouse button, modified by the slash, star and minus keys to select which button is clicked when you press it. To click and hold, press keypad 0 to hold, then 0 again to release.
	We'll do more with system administration later in the sequence, often using the command line, but some of those functions are available here in the KDE Command Center. Unfortunately, to add a font you need a TrueType or PostScript Type 1 font file. [ Exercises: Look at the Font Installer tool. Select the Login Manager and click “Administrator Mode”. Enter the root password. Choose “Sessions” and set Remote shutdown to either “Nobody” or “Only root”. ]
	[ Exercises: Select Preferences -> About Myself. Change the linuxed full name to “Linux Lab User” and make the office number “89 Durham”. Select Preferences -> Password. Change the password from “linuxed” to “whynot?”. Then change it back to “linuxed”. ]
	Services are background programs that are owned by the system, not by the user. They provide things like printing, Internet services. firewall, etc.
	The Add/Remove Programs tool installs and uninstalls programs specifically from the Red Hat CDs. It's the same system that was used to install packages during the system installation. If the machine is connected to the Internet through a fast network and is registered with the Red Hat Network, you're better off using the tools on the Web at http://rhn.redhat.com to add and remove packages: Packages you install with RHN are registered for automatic notification/installation of updates; A wider variety of packages is available through the non-RedHat (ISU) channels.
	[ Exercise: log out and log back in using the Gnome Desktop instead of KDE. Now choose the Preferences menu to explore the settings changes possible for the Gnome Desktop. ]
	One of the good things about Gnome Desktop is for those with various disabilities is that lots of assistive technology is built in. Not only does Gnome support special keyboard features for those with motor control problems (like slow and sticky keys), but for the visually impaired there are screen magnifiers and even a full-blown audio screenreader (which usually costs several hundred dollars in that other operating system). All of these features can be activated under Preferences > Accessibility.
	You can take screenshots with GIMP the way we did in KDE, but Gnome also has its own little screenshot utility. Unfortunately, it only dumps the entire screen; you can't select part of the display or an open window. [ Exercise: Save the screen to a file. 1. Choose Actions > Take Screenshot. 2. Enter a filename. 3. Click Save. ]
	WindowMaker is an alternative to KDE and Gnome. It's especially good on older machines, as the overhead is much smaller. If you don't have WindowMaker on your RHEL machine and you've set up for the Dag Wieers repository (which is done automatically with the Iowa State install) you can install it with the command up2date -i windowmaker
	Many features of WindowMaker are triggered by right-clicking. Right-clicking the desktop activates the application menu, which will stay open until you select something. If you move the menu by dragging its title bar, it will stay open (and on top of the other windows) until you click its close box. You can do the same thing with submenus as well, and the parent menu can be closed without closing the submenu.
	The Dock, in the upper right-hand corner, has icons to launch commonly used applications. If three dots appear on the button, the application can be launched. If not, the application is already running. There are also “dockapps”, applications designed specifically to run in the dock for chores like displaying weather, mounting CDs, etc.
	The WindowMaker title bar is simpler than the others; you minimize on the left and close on the right. Double-clicking on the titlebar reduces the window to the titlebar (windowshading). For anything fancier than that, right-click on the titlebar for the window menu. Moving a window is done by dragging the titlebar, and resizing the window is done by click-hold-and-drag on the lower corners of the window (betraying WM's Mac OS heritage).
	WindowMaker has a unique trick; it can create new virtual workspaces on the fly. Just choose “Workspaces > New” from the Application menu. To move windows, right-click on the titlebar and choose “Move to”. To switch workspaces, click on the arrows on the Clip or choose a workspace from the Application menu. Notice that workspaces can be named; right-click on the Clip to rename the workspace.
	[ Exercise: Log out of WindowMaker and log back in using Failsafe. Type ooffice at the command prompt to prove you're really running a window manager (just not a very good one). Exit OpenOffice.org, then press <Ctrl/D> to return to the login screen. ]

Last Revised September 20, 2005 by Jeff Balvanz (jbalvanz@iastate.edu)

Basic UNIX 4: More on the GUI	Page 13

Jeff Balvanz

2005-02-07T08:15:13