Running Linux phần 7 potx

41 259 0
Running Linux phần 7 potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter 11. Customizing Your X Environment 343 color names (and corresponding RGB values) is given in the file /usr/lib/X11/rgb.txt. Running xcolors will display these colors, along with their names. Line 6 runs another xterm, although the arguments are slightly different: xterm -geometry -20+10 -fn 7x13bold -fg darkslategray -bg white & First of all, the geometry specification is just -20+10 . Without size parameters, xterm will use the default, which is usually 80x25. Also, we see that the xoffset is prefixed with a -, instead of a + . This places the window 20 pixels from the right edge of the screen. Likewise, a geometry specification of -20-30 (as used on line 7) means to place the window 20 pixels from the right edge of the screen and 30 pixels from the bottom. In this way, the placement of windows is less dependent on the particular resolution you're using. The -fn option on lines 6 and 7 specifies that the font used by xterm should be 7x13bold . Using the command xlsfonts displays a complete list of fonts on your system; the X client xfontsel allows you to select fonts interactively — more about fonts later. On line 10 we start an oclock client, which is a simple analog clock. Line 11 starts xload, which displays a graph of the system load average (number of running processes) that changes with time. Line 12 starts xbiff, which just lets you know when mail is waiting to be read. Finally, on line 13 we do away with the bland gray X background and replace it with a flashy darkslateblue. (Fear not; there is more fun to be had with X decor than this example shows.) You'll notice that each X client started on lines 6-13 is executed in the background (the ampersand on the end of each line forces this). If you forget to put each client in the background, xinit executes the first xterm, waits for it to exit (usually after you log out), executes the next xterm, and so on. The ampersands cause each client to start up concurrently. What about line 16? Here, we start fvwm (Version 2), a window manager used on many Linux systems. As mentioned before, the window manager is responsible for decorating the windows, allowing you to place them with the mouse, and so forth. However, it is started with the command: exec fvwm2 This causes the fvwm2 process to replace the xinit process. This way, once you kill fvwm, 2 the X server shuts down. This is equivalent to, but more succinct than, using the Ctrl-Alt- Backspace key combination. Whether you are returned to the command line after the X server has shut down or are presented with a new graphical login depends on your system configuration. In general, you should put an ampersand after each X client started from .xinitrc, and exec the window manager at the end of the file. Of course, there are other ways of doing this, but many users employ this technique. 2 If you have experimented with fvwm, you'll notice that pressing the first mouse button while the cursor is on the background causes a menu to pop up. Selecting the Quit fvwm option from this menu causes fvwm to exit. Chapter 11. Customizing Your X Environment 344 The fvwm2 window manager was the default window manager on most Linux systems for a very long time. It is still around, but has mostly been superseded by either the very advanced kwin window manager shipped with KDE or one of the more modern freestanding window managers, such as blackbox or sawfish. If you read the manual pages for xterm and the other X clients, you'll see many more command-line options than those described here. As we said, virtually everything about X is configurable. fvwm (Version 2) uses a configuration file of its own, .fvwm2rc, described in its manual page. (If you have no .fvwm2rc file, the system default /usr/lib/X11/fvwm2/system.fvwmrc is used instead.) More modern window managers still use configuration files, but usually provide you with user-friendly, GUI-based configuration programs that let you make your settings and then save them to the configuration file in the correct format. The manual pages, as well as books on using X, such as the X Window System User's Guide (O'Reilly), provide more information on configuring individual clients. 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 Chapter 11. Customizing Your X Environment 345 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 Chapter 11. Customizing Your X Environment 346 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: kdesupport 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 aRts is short for "real-time sequencer" and forms the base of most of the multimedia capabilities of KDE. kdelibs 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. kdebase 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. kdegames 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. kdegraphics A number of graphics-related programs such as a dvi viewer, a PostScript viewer, and an icon editor. Chapter 11. Customizing Your X Environment 347 kdeutils Some productivity tools, such as text editors, a calculator, printer managers, and an address-book program. kdemultimedia As the name implies, this package contains multimedia programs, including a CD player, a MIDI player and — of all things — a Karaoke player. kdenetwork Here, you will find programs for use with the Internet, including a mail reader, a news reader, and some network management tools. kdeadmin This package contains some programs for the system administrator, including a user manager, a runlevel editor, and a backup program. kdepim The notable tool in this package is korganizer, a full-featured personal information manager that even supports synchronization with Palm Pilots. kdeedu 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 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. Chapter 11. Customizing Your X Environment 348 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. 3 You can add this directory to your PATH variable by issuing: 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. 11.2.3.1 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. 3 Some distributions might put the KDE programs elsewhere, such as in /usr/bin. Chapter 11. Customizing Your X Environment 349 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 Chapter 11. Customizing Your X Environment 350 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 Add 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! 11.2.3.2 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. 11.2.3.2.1 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). Chapter 11. Customizing Your X Environment 351 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. Chapter 11. Customizing Your X Environment 352 11.2.3.2.2 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. 11.2.3.2.3 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. [...]... contain: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Clock*Geometry: XLoad*Geometry: XBiff*Geometry: 70 x70+5+5 85x50+85+5 +200+5 ! Defaults for all xterm clients XTerm*Foreground: white XTerm*Background: black ! Specific xterms xterm-1*Geometry: 80x40+10+110 xterm-2*Geometry: xterm-2*Font: xterm-2*Background: -20+10 7x13bold darkslategray xterm-3*Geometry: xterm-3*Font: 80x25-20-30 7x13bold Lines 1-3 set... is no Linux driver, do not despair Although you may have to wait a while for it, most mainstream hardware devices that are supported by Windows will eventually be supported by Linux, too For example, Linux drivers for USB devices used to be rare and flaky, but now many common USB devices work just fine on Linux You can get updated information about which USB devices work on Linux at http://www .linux- usb.org... no Linux equivalent, or for which the Linux counterpart is not fully compatible There are essentially four ways in which Linux and Windows can cooperate: • • • • Sharing CDs and floppy disks ("sneakernet") Sharing a computer by being installed on separate partitions Sharing data over a network Running concurrently on the same computer using an emulator or virtual machine When Windows and Linux are running. .. similar in feature richness (or poverty) to the Notepad editor on Windows 376 Chapter 11 Customizing Your X Environment systems, and KWrite is somewhere in-between You will find all three of them in the K menu, under the submenu Editors 377 Chapter 12 Windows Compatibility and Samba Chapter 12 Windows Compatibility and Samba Linux is a remarkably effective operating system, which in many cases can completely... continue to use other operating systems as well as Linux, or at least to exchange files directly with them Linux satisfies such yearnings with internal enhancements that allow it to access foreign filesystems and act on their files It can mount DOS/Windows partitions on the system's hard disk, or access files and printers shared by Windows servers on the network Linux can also run DOS and Windows applications,... written on one system and read on the other Both Windows and Linux have the capability to read and write CDs in industry standard, ISO9660 format The cdrecord program, which runs on Linux and other Unix flavors, can create CDs using Microsoft's Joliet extensions to the ISO9660 standard, making Windows feel right at home with the disc format 378 ... that it's up to date 11.4.1 Installing and Updating GNOME Most Linux distributions include GNOME, but if you haven't installed it yourself, or if you want a newer version, you can visit http://gnome.org for source and http://ximian.com for convenient binaries Ximian offers a preassembled distribution of the desktop for the most common Linux distributions To install it, do the following: 360 Chapter... for all invocations of xterm to 7x13bold, instead of specifying it on each command line Recently, X resources have fallen out of favor with X developers While they are really very flexible, they are not particularly easy to work with and feel more like a relic of ancient times A growing number of programs are therefore customized not by X resources but instead via 371 Chapter 11 Customizing Your X... click the middle button konsole pastes in what you've selected on the next command line See the result in Figure 11 -7 Now you can type in the remainder of the directory name for_website and press the Enter key to execute the command 355 Chapter 11 Customizing Your X Environment Figure 11 -7 konsole window after text is pasted You can select anything you want in the window — output as well as input To... 7x13bold Lines 1-3 set the Geometry resource class for the Clock, XLoad, and XBiff application classes On lines 6 -7, we set the Foreground and Background resource classes for the XTerm class as whole All xterm clients will use these values for Foreground and Background by default On lines 10- 17, we set resources specific to each invocation of xterm This is necessary because not all the xterms are alike; . /usr/lib/X11/rgb.txt. Running xcolors will display these colors, along with their names. Line 6 runs another xterm, although the arguments are slightly different: xterm -geometry -20+10 -fn 7x13bold -fg. particular resolution you're using. The -fn option on lines 6 and 7 specifies that the font used by xterm should be 7x13bold . Using the command xlsfonts displays a complete list of fonts. 11 -7. Now you can type in the remainder of the directory name for_website and press the Enter key to execute the command. Chapter 11. Customizing Your X Environment 356 Figure 11 -7.

Ngày đăng: 24/07/2014, 02:20

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan