3.2. 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.
KDE employs a component technology called KParts that makes it possible to embed one application into another transparently, such that, for example, the web browser Konqueror can display PDF documents in its own browser window by means of the PDF display program KPDF , without Konqueror having to have a PDF display component of its own. The same goes for the KOffice suite (see http://koffice.kde.org), discussed in Chapter 8, where, for example, the word processor KWord can embed tables from the spreadsheet application KSpread seamlessly.
KDE is in ever-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. The KDE team makes these available in source form, and most distributions provide easy-to-install binary packages within days of a source release. 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 fainthearted. At the time of this writing, the current stable release was 3.4.2. To stay current with KDE development, visit http://www.kde.org, the official web site of the KDE project, often.
3.2.1. General Features
One of the goals of the KDE team is to make everything in KDE configurable by GUI dialogs. Underneath the configuration system lies a set of text files in a fairly simple parameter=value format; you can edit these if you prefer, but you never need to. 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, not just via FTP or HTTP, but also to and from a digital camera, or using SSH encryption, or in other ways.
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.
Although 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 (which are generated from XML files in the background) 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 will also support other modern X11 features such as anti-aliasing if your X server supports them (most X servers do, by means of the so-called RENDER extension).
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 such as 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).
3.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. http://www.kde.org/mirrors/ gives you a list of mirrors.
KDE consists of a number of packages. These include the following:
In addition to the packages mentioned here, which are officially provided by the KDE team, literally hundreds of other KDE programs have been developed. See http://www.kde.org/applications.html for a list of applications that are currently available.
Once you have selected which packages to install, your procedure for the actual installation 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.[*] You can add this directory to your PATH variable by issuing:
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:
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 following single line:
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.
If, for some reason, you plan to install KDE packages in more than one directory tree, you will also need to set the environment variable KDEDIRS to contain the path to all the trees. Normally, this is not necessary.
3.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.
126.96.36.199. The KDE panel and the K menu
When you start KDE for the first time, it looks like Figure 3-1. Along the lower border of the screen, you see the so-called panel. The panel serves several purposes, including fast access to installed applications and the currently opened windows. KDE also opens a configuration program that lets you configure the initial settings when started for the first time.
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 in workspace One, whereas 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 in workspace Two, but its label is visible on the taskbar that appears in all workspaces. When you are in any other workspace, click the terminal label in the taskbar. This will immediately bring you back to the workspace where your terminal is shown.
Figure 3-1. The KDE desktop at startup
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 workspaceit has been "pinned down" to the background of the desktop, so to speak.
If you grow tired of seeing the terminal window in every workspace, simply click the pin again. 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.
KDE can be configured in many different ways, and the window decorations are just one thing. It might therefore be that you do not have the little pushpin button, because your configuration does not include it. In that case, you can left-click on the application in the left corner of the title frame and select To Desktop All Desktops instead.
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 Alt-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 either find in the System submenu or start from the command line with kappfinder. 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, right-click somewhere on the panel where it does not contain any items and select Add to Panel Application from the menu that pops up. 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 submenus to the panel by selecting the first menu entry (Add This Menu) 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 are other things besides application starter buttons that you can add to the panel as well: for example, panel applets, small programs that are designed to run inside the panel and cannot run as standalones. Just explore the Add to Panel submenus, and you will find many interesting things.
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 the Remove menu item (they will be called different things depending on what you are trying to 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!
188.8.131.52. 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. (On some distributions, the Control Center is at the top level of the K menu; in others, such as Debian, it is in a submenu such as Settings.) Configuration options are grouped into different types of operations. 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 Appearance & Themes group and choose Background. The configuration window for configuring the background will appear (see Figure 3-2).
Figure 3-2. 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 blending effect that combines various choices. To select colors, click on either of the two color buttons; 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 do not see any changes in the monitor, check whether the Picture option is checked. If that is the case, the selected picture will overlay your background color selection in some modes (such as Scaled, which resizes the selected picture to fill the whole background). But try selecting a picture and then experiment with the blending effects to get a combination of background colors (possibly with gradients) and your picture.
If all you want is a monocolored background, select "No picture" in the Background group, and Colors: Single Color in the Options group. You will see that the second color button is grayed out then. Select the color you want with the first color button.
If you want a background picture, but cannot find a suitable one among either your own or the ones provided with your distribution, click the Get New Wallpapers button and you will get a huge list of wallpapers that have been contributed by KDE users; there surely is something for every taste!
You can do more things with the background, but we'll leave it at that for now and look at something else: configuring the 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 the window contents. KDE is different. Because KDE is an integrated desktop, color and other settings apply to both the window decorations painted by the window manager and 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 Appearance & Themes group, and choose Colors. You'll see a preview window and a selection list where you can pick a color scheme. KDE works not 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.
Although 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. Although 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 Appearance & Themes 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 drawnfor example, as in Windows (style MS Windows 9x), as in Motif (style Motif), as on an SGI workstation (style SGI), or even something original such as the "Light" styles or the all-time KDE favorites "Plastik" and "Keramik."[*] 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 Region & Language page in the Regional & Accessibility group (see Figure 3-3). 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 medium.
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, KDE uses U.S. English, which always is present.
While speaking about different languages, it might also be worthwhile to briefly go into keyboard layouts. Most European languages, even those based on the Latin alphabet, have special characters that are either not available on other keyboards or are just awkward to type. KDE comes with a nifty little program that lets you quickly change keyboard layouts. Of course, it cannot change the labeling on your keys, but quickly changing layouts may already be helpful if you are regularly moving in different worlds such as some of the authors of this book do. To turn on this feature, go to the Keyboard Layout page in the Regional & Accessibility group and check the Enable keyboard layouts box. Then select the Active layouts that you plan to use among the Available layouts. Once you click on Apply, a little flag button will appear on the right-hand side of the panel (in the so-called system tray); clicking on this flag lets you change keyboard layouts on the fly.
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 are very useful nevertheless, so be sure to check the documentation at http://www.kde.org/documentation/index.html.
Figure 3-3. Configuring the language of the KDE desktop