11.3. The K Desktop Environment
The K Desktop Environment 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 amazing 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 other window manager. However, it also comes with its own window manager called kwm, which will give best results and is therefore what we will cover here.
In the section about configuring the fvwm window manager, you have seen that configuring Linux desktops usually means learning the syntax of configuration files and editing those files, something that long-term Linux users take for granted but that often rebuffs new users. The KDE team has therefore made it one of its goals that everything that is configurable in KDE (and about everything is) should be configurable via 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 like 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 provides a full Internet integration of the desktop. It comes with a file manager that doubles as a web browser, and browsing files on some FTP site 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. 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 central to 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.
While manual pages are very well suited 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 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 a few releases, the X Window System has supported a feature called session management. This is a capability that lets you leave your X environment (for example, because you want to turn off or reboot your computer), and when you return to X, all the applications that you had opened 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.
It should be mentioned that KDE is not just another window manager. KDE contains a window manager, kwm, and a very good 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.
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 to integrate them as far as possible into the overall desktop. For example, if you so 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).
The current development version of KDE, as well as the upcoming KDE office suite (see http://koffice.kde.org ), is heavily based on CORBA, which among other things enables embedding of office components running on different machines into each other.
KDE is in continuing development, but every few months the KDE team releases 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 package 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 at heart.
11.3.1. 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:
In addition to the packages mentioned here, which are officially provided by the KDE team, there are literally hundreds of other KDE programs 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 do. 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/kde/bin, but if you have chosen to install KDE to another location, you will have to insert your path here. You can add this directory to your PATH variable by issuing:
To make this permanent, either add this line to your configuration file .bashrc in your home directory or to the system-wide configuration file /etc/profile.
Next, do the same with the directory containing the KDE libraries (by default /opt/kde/lib) and the environment variable 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:
11.3.2. 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 start further explorations into your KDE desktop.
When you start KDE for the first time, it looks like Figure 11-3. 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 for quickly accessing any window currently on the desktop. In addition, KDE opens a file manager window when started for the first time.
Figure 11-3. The KDE desktop at first startup
KDE provides a number of workspaces that are accessible via the buttons in the middle of the panel, labeled One to Four by default. Try clicking on those buttons. You can see how the file manager window is 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 calculator by clicking on the calculator icon on the panel. When the panel appears, change workspaces again. You will see that the calculator is visible only while you are on workspace Two. When you are on any other workspace, click on the calculator label in the taskbar. This will immediately bring you back to the workspace where your calculator is shown.
To try another nifty feature, push the small button in the title bar of the calculator window that looks like a push pin. Now change workspaces again. You will see that the calculator 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 the calculator window on every workspace, simply click on the pin again, and if you want to get rid of the window as a whole, click on 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 take you now on a short exploration trip to the so-called K menu. You open the K menu by clicking on 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, simply 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 you can also integrate non-KDE applications into the K menu and the panel, that is, showing them as icons that you can click on to run the associated programs, even though this requires a little bit more work.
Depending on how you have installed KDE, it may well be that there is already a submenu Non-KDE programs in your K menu that contains a number of non-KDE applications. If you don't have this, run the application Appfinder that you can find in the System submenu. This is a tool that 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 .kdelnk 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 .kdelnk 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, but this time, first open the submenu Panel and then the submenu Add Application. Probably much to your surprise, something that looks like a copy of the 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 Application tree. The icon will then have a small black arrow in it, which indicates that clicking on 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. In general, you can get at a lot of functionality in KDE by clicking the right mouse button!
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 on the plus signs, you can open a group to see the entries in this group.
As an example, we will now change the background color to something else. To do this, open the Desktop group and choose Background. After a short time, the configuration window for configuring the background will appear (see Figure 11-4).
Figure 11-4. Configuring the background of the KDE desktop
By default, the background is configured to have one single color. If you want to leave it at that and just change this color, click on the color field below the One Color button. A color selection dialog pops up where you can select a color to your tastes. 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 on 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 think that a single color is boring, maybe you want a gradient where one color is slowly morphed into another. In this case, select the Two Colors button and select a second color; KDE will compute the gradient and display it in the monitor.
You also have the option of using a background image. If that is what you want, go to the Wallpaper area of the configuration dialog. You can either select one of the wallpapers that come with KDE, which contains some very stylish ones, by choosing from the drop-down list, or you can select any graphics file of your own.
There are more things you can do with the background, but we'll leave it at that for now and look at something else: Configuring styles and colors of the windows.
With normal window managers, you can configure the color of the window decorations, but not of the window contents. With KDE, this 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 Desktop 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'd 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 on the Apply button and watch how all running applications flicker a bit and suddenly change colors--without having to restart them. While Windows users tend to take this for granted, it was never seen before on Unix before KDE.
The same feature applies to other settings. For example, open the Desktop group and choose Style. Here, you can select "Windows 95" style. If this is selected, all user interface elements are drawn according to the Windows standard; if it is not selected, they are drawn according to the Motif standard common on Unix. 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.
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 Language page in the Desktop group (see Figure 11-5). Here, you can select the language in which your KDE desktop and the KDE applications should be running. Currently, KDE lets you choose from more than thirty languages.
Figure 11-5. 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 primary language. In this case, the secondary language is chosen automatically for that application, and if there is no translation available for this application, the tertiary language is chosen. 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 those that are not so obvious but very useful nevertheless, so be sure to check the documentation at http://www.kde.org /documentation/index.html.
Copyright © 2001 O'Reilly & Associates. All rights reserved.