home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Running Linux, 4th Ed.Running Linux, 4th Ed.Search this book

11.2. The K Desktop Environment

The K Desktop Environment (KDE) is an open source software project that aims at providing a consistent, user-friendly, contemporary desktop for Unix, and hence, Linux systems. Since its inception in October 1996, it has made great progress. This is partly due to the choice of a very high-quality GUI toolkit, Qt, as well as the consequent choice of using C++ and its object-oriented features for the implementation.

It should be noted up front that KDE is not a window manager like fvwm, but a whole desktop system that can be used with any window manager. However, it also comes with its own window manager called kwin, which will give the best results and is therefore what we will cover here.

The current development version of KDE, as well as the upcoming KDE office suite (see http://koffice.kde.org ), is based heavily on KParts, a component technology which, among other things, enables the embedding of office components, such as embedding the PDF viewer into the web browser for seemless viewing of downloaded PDF files, and so on.

KDE is in continuing development, but every few months the KDE team puts out a so-called official release that is considered very stable and suitable for end users. These releases are made available in both source and binary packages in various formats, often specifically adapted for the most common Linux distributions. If you don't mind fiddling around with KDE and can stand an occasional bug, you can also live on the bleeding edge and download daily snapshots of KDE, but this is not for the faint-hearted. At the time of this writing, the current stable release is 3.0.2, with 3.0.3 just looming around the corner.

11.2.1. General Features

We have already hinted a couple of times that configuring window managers and X applications for a long time meant learning the varying syntax of configuration files and editing those files, something that long-term Linux users take for granted but that often rebuffs new users. One of the goals of the KDE team is therefore to make everything in KDE configurable by GUI dialogs. You can still edit configuration files, if you prefer, but you don't need to, and even the most experienced users usually admit that in order to do simple things, such as change the background color of the desktop, it's faster to click a few buttons than to read the manual page, find the syntax for specifying the background color, open the configuration file, edit it, and restart the window manager.

Besides easy configuration, KDE sports a few other features that were previously unheard of on Linux. For example, it integrates Internet access fully into the desktop. It comes with a file manager that doubles as a web browser (or the other way around), and browsing files on some FTP sites is just the same as browsing your local hard disk. You can drag and drop icons that represent Internet locations to your desktop and thus easily find them again later. KDE integrates search engines and other Internet resources into your desktop and even lets you define your own favorite search engines and Internet links with ease. In addition, almost all KDE application are able to open and save files in remote locations.

Drag-and-drop, commonplace on Windows or the Macintosh, is also widely used in KDE. For example, to open a file in the text editor, you just grab its icon in the file manager window and drop it onto the editor window. This works no matter where the file is located; if it is on a remote server, KDE automatically downloads the file for you before opening it in the text editor or whichever application you choose to open it with. The same goes for multimedia files. Just by clicking an icon for an MP3 file on a remote server, you can download it in the background and play it locally.

While manual pages are designed well to give programmers instant access to terse information about system libraries, they are not really very well suited for end-user documentation. KDE therefore uses standard HTML files and comes with a fast help viewer, the KDE Help Center. The viewer also knows how to display manual page and Info files so that you can access all the documentation on your system from one application. In addition, most KDE applications support context-sensitive help.

For the past few releases, the X Window System has supported a feature called session management. When you leave your X environment, log off, or reboot, an application that understands session management will reappear at the same positions and in the same configuration. Unfortunately, this very user-friendly feature was rarely supported by X applications. KDE uses it extensively. KDE provides a session manager that handles session management, and all KDE applications are written to behave properly with that feature.

KDE contains a window manager, kwin, and an excellent one at that, but that is only one part of KDE. Some of the others are the file manager, the web browser, the panel, a pager, the control center for configuring your desktop, and many, many more. If you want to, you can even run KDE with another window manager, but you might lose some of the integration features. Also, KDE comes with tons of applications, from a full office productivity suite to PostScript and PDF viewers to multimedia software to games.

You might be thinking, "Well, this all sounds very nice, but I have a couple of normal X applications that I want to run." In this case, you will be delighted to hear that you can continue to do that. Yes, you can run all X applications on a KDE desktop, and KDE even provides some means of integrating them as far as possible into the overall desktop. For example, if you desire, KDE can try to reconfigure your other X applications to use the same colors as the overall desktop so that you get a nice consistent environment. Of course, non-KDE applications will not support some of KDE's advanced features like drag-and-drop or session management, but you can continue to use the programs you have grown accustomed to until someone releases KDE applications that address the same needs (or perhaps KDE versions of your favorite programs themselves).

11.2.2. Installing KDE

Most Linux distributions come with KDE nowadays, but if yours doesn't, or you want to use a newer version of KDE, you can download it from the Internet. http://www.kde.org is your one-stop shop for everything KDE-related, including documentation, screenshots, and download locations. ftp://ftp.kde.org is the KDE project's FTP site, but it is often overloaded, so you might be better off trying a mirror instead.

KDE consists of a number of packages. These include:

This package contains third-party libraries that are not part of KDE itself but that are used by KDE. It is recommended that you install this package to make sure that you have the correct versions of all the libraries installed.

aRts is short for "real-time sequencer" and forms the base of most of the multimedia capabilities of KDE.

The KDE libraries. They contain the basic application frame, a number of GUI widgets, the configuration system, the HTML display system, and many other things. Without this package, nothing in KDE will run.

In this package, you will find the basic KDE applications that make a desktop a KDE desktop, including the file manager/web browser, the window manager, and the panel. You definitely need this package if you want to use KDE.

A number of games, including card games, action games, and strategy games. Everybody will probably want to install these, but only to get acquainted with the system, of course.

A number of graphics-related programs such as a dvi viewer, a PostScript viewer, and an icon editor.

Some productivity tools, such as text editors, a calculator, printer managers, and an address-book program.

As the name implies, this package contains multimedia programs, including a CD player, a MIDI player and — of all things — a Karaoke player.

Here, you will find programs for use with the Internet, including a mail reader, a news reader, and some network management tools.

This package contains some programs for the system administrator, including a user manager, a runlevel editor, and a backup program.

The notable tool in this package is korganizer, a full-featured personal information manager that even supports synchronization with Palm Pilots.

As the name implies, this package contains a set of educational programs, ranging from vocabulary trainers to programs teaching you the movements of the planets and stars.

KOffice is no less than a complete feature-rich office productivity suite. It may have a few rough edges here and there, but many people use it already for their daily work.

The release cycle of KOffice is today decoupled from KDE's release cycle. At the time of this writing, the current version is 1.1.2. You can read all about KOffice at http://koffice.kde.org.

In addition to the packages mentioned here, which are officially provided by the KDE team, literally hundreds of other KDE programs are available. See http://www.kde.org/applications.html for a list of applications that are currently available.

Once you have selected which packages to install, you can go on and actually install them. How you do that depends on which Linux distribution you use and whether you install a binary package or compile KDE yourself from the source code. If your distribution contains KDE, you will also be able to install KDE during your system installation.

Once the software is loaded onto your hard disk, there are only a few steps left to take. First, you have to make sure that the directory containing the KDE applications is in your PATH environment variable. The default location of the executable KDE programs is /opt/kde3/bin, but if you have chosen to install KDE to another location, you will have to insert your path here.[42] You can add this directory to your PATH variable by issuing:

[42]Some distributions might put the KDE programs elsewhere, such as in /usr/bin.

          export PATH=/opt/kde3/bin:$PATH

To make this permanent, add this line to either the .bashrc configuration file in your home directory, or the system-wide configuration file, /etc/profile.

Next, do the same with the directory containing the KDE libraries (by default /opt/kde3/lib) and the environment variable LD_LIBRARY_PATH:

          export LD_LIBRARY_PATH=/opt/kde3/lib:$LD_LIBRARY_PATH

Now you are almost done, but you still need to tell X that you want to run the KDE desktop when X starts. This is done in the file .xinitrc in your home directory. Make a backup copy first. Then remove everything in this file and insert the single line:

          exec startkde

startkde is a shell script provided with KDE that simply starts up the KDE window manager kwin and a number of system services. Distributions will usually install a somewhat more complex .xinitrc file that may even start non-KDE applications and services.

11.2.3. Using KDE

Using KDE is quite easy. Most things are very intuitive, so you can often simply guess what to do. We will, however, give you some hints for what you can do with KDE here, to encourage you to explore your KDE desktop further. The KDE panel and the K menu

When you start KDE for the first time, it looks like Figure 11-2. Along the lower border of the screen, you see the so-called panel. The panel serves several purposes, including fast access to installed applications. Along the upper border, you can see the taskbar. This bar shows all open windows and can be used to quickly access any window currently on the desktop. In addition, KDE opens a configuration program that lets you configure the initial settings when started for the first time.

Figure 11-2

Figure 11-2. The KDE desktop at startup

KDE provides a number of workspaces that are accessible via the buttons in the middle of the panel, labeled One to Eight by default. Try clicking those buttons. You can see that windows that you have opened are visible only while you are on workspace One, while the panel and the taskbar are always visible. Now go to workspace Two and start a terminal window by clicking the terminal icon on the panel. When the panel appears, change workspaces again. You will see that the terminal window is visible only while you are on workspace Two, but its label is visible on the taskbar that appears in all workspaces. When you are on any other workspace, click the terminal label in the taskbar. This will immediately bring you back to the workspace where your terminal is shown.

To try another nifty feature, push the small button that looks like a pushpin in the titlebar of the terminal window. Now change workspaces again. You will see that the terminal window is now visible on every workspace — it has been "pinned down" to the background of the desktop, so to speak.

If you grow tired of seeing the terminal window on every workspace, simply click the pin again, and if you want to get rid of the window as a whole, click the button with the little x on it in the upper-right corner.

There are lots of things that you can do with windows in KDE, but we'll switch now to a short exploration of the so-called K menu. You open the K menu by clicking the icon with the gear-and-K symbol to the far left of the panel. Besides some options for configuring the K menu and the panel itself, you will find all installed KDE applications here, grouped into submenus. To start one of those applications, select the menu entry.

We have promised that you can run old X applications on your KDE desktop. You can do that either by opening a terminal window and typing the application name on the command line, or by pressing Ctrl-F2 and entering the application name in the small command line that appears in the middle of the screen. But, with a little more work, you can also integrate non-KDE applications into the K menu and the panel, which then displays icons that you can click to run the associated programs

Depending on how you have installed KDE, it may well be that there is already a submenu of non-KDE programs in your K menu that contains a number of non-KDE applications. If you don't have this, run the application KAppfinder, which you can find in the System submenu. This searches your system for a number of applications that it has in its database and integrates each one into the KDE desktop by generating a so-called .desktop file for it. If the program that you want to integrate into KDE is not included in the Appfinder's database, you will have to write such a .desktop file yourself. But as always in KDE, there are dialogs for doing this where you just have to fill in the required information. See the KDE documentation at http://www.kde.org/documentation/index.html.

By default, the panel already contains a number of icons to start the most often-used programs, but you can easily add your own. To do this, open the K menu again, and click the submenus Configure Panel Figure Add Figure Button. A copy of the whole K menu pops up. Find the application whose icon you want to add to the panel and select it, just as if you wanted to start it. KDE will then add the icon for this application to the panel. You can even add full submenus to the panel by selecting the first menu entry in a submenu in the Add/Button tree. The icon will then have a small black arrow in it, which indicates that clicking the icon opens a menu instead of starting an application.

There is only limited space on the panel, so you might need to remove some icons of programs that you do not often use. Just click with the right mouse button on the icon and select Remove. This does not remove the program, just its icon. In general, you can get at a lot of functionality in KDE by clicking the right mouse button! The KDE Control Center

Next, we will show you how to configure your KDE desktop to your tastes. As promised, we will not edit any configuration files to do this.

Configuration is done in the KDE Control Center, which you can start from the K menu. All the configuration options are grouped at different levels. When you start up the control center, you will see the top-level groups. By clicking the plus signs, you can open a group to see the entries in this group. Configuring the background

As an example, we will now change the background color to something else. To do this, open the Look & Feel group and choose Background. The configuration window for configuring the background will appear (see Figure 11-3).

Figure 11-3

Figure 11-3. Configuring the background of the KDE desktop

You can select a single-colored background, a two-colored background with a number of gradients where one color is slowly morphed into another, a wallpaper (predefined or an image of your own choice), or a bleeding effect that combines various choices. To select colors, click either the Color 1 or the Color 2 color button; a color selection dialog pops up where you can select a color to your taste. When you close the color selection dialog, the new color is displayed in the monitor in the upper-right corner of the configuration window. When you configure KDE, you often see such monitors that allow you to preview your choice. However, you also have the option to see what your choice looks like when in full use. Simply click the Apply button at the lower border of the configuration window, and your change is automatically applied. There is no need to restart the desktop.

If you'd rather have a monocolored background, select Flat from the Mode combo box. You will see that the color button for the Color 2 is grayed out then. Select the color you want with the Color 1 button.

On the Wallpaper tab, you can select a background image as your wallpaper. KDE ships with a large number of wallpapers, but you can also select your own pictures (such as a digitized photo of your family). You can even configure multiple wallpapers that appear in succession at intervals you define. Finally, on the Advanced tab, you can select different blendings. These are difficult to describe, so your best bet is to try them and watch the small monitor to see what effect you get.

You can do more things with the background, but we'll leave it at that for now and look at something else: configuring styles and colors of the windows. Configuring window styles and colors

With normal window managers, you can configure the color of the window decorations, but not of the window contents. KDE is different. Since KDE is an integrated desktop, color and other settings apply both to the window decorations painted by the window manager and to the window contents painted by the applications. We'll now set off to configure a little bit of the appearance.

In the control center, open the Look & Feel group, and choose Colors. You'll see a preview window and a selection list where you can pick a color scheme. KDE does not work by configuring individual colors, but by defining so-called color schemes. This is because it does not make sense to change only one color; all colors must fit together to achieve a pleasing and eye-friendly look.

While KDE lets you create your own color schemes, doing so is a task that requires some knowledge about color psychology and human vision. We therefore suggest that you pick one of the predefined color schemes. Check in the preview monitor whether you like what you see. Now comes the fun part: click the Apply button and watch how all running applications flicker a bit and suddenly change colors — without you having to restart them. While Windows users tend to take this for granted, it was never seen on Unix before KDE.

The same feature applies to other settings. For example, open the Look & Feel group and choose Style. Here, you can select among a large number of so-called styles. The styles determine how the user interface elements are drawn — e.g., as in Windows (style Qt Windows), as in Motif (style Qt Motif), as in RISC OS (style RISC OS), or even something original as the "Light" styles. You can change this setting by clicking Apply and watch your running applications change their style. The same goes, by the way, for the fonts that you can select on the Font page. Internationalization

There are many more things to configure in KDE, but we cannot go through all the options here. Otherwise there would not be much space left for other topics in this book. But there's one more thing that we'd like to show you. You will especially like this if English is not your native language or if you frequently converse in another language.

Go to the Country & Language page in the Personalization group (see Figure 11-4). Here, you can select the country settings and the language in which your KDE desktop and the KDE applications should be running. Currently, KDE lets you choose from more than 80 country settings and languages. Note that you need to have a language module installed in order to be able to select a particular language. You can either download those from the KDE FTP server (as explained earlier) or install them from your distribution media.

Figure 11-4

Figure 11-4. Configuring the language of the KDE desktop

You might be wondering why you can select more than one language. The reason is that the KDE programs are translated by volunteers, and not all the applications are translated at the same time. Thus, a particular application might not be available in the language that you have chosen as your first language (the topmost one in the Language list). In this case, the next language is chosen automatically for that application, and if no translation is available for this application in that language either, the next language is chosen, and so on. If all else fails, English is chosen, which always exists.

There is much more to say about using the KDE desktop, but we'll let you explore it yourself. Besides the obvious and intuitive features, there are also some that are not so obvious but very useful nevertheless, so be sure to check the documentation at http://www.kde.org/documentation/index.html.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.