5.7. 桌面環境
前一頁 | 章 5. X Window 視窗系統 | 下一頁

## 5.7. 桌面環境

Contributed by Valentino Vaschetto.

本章會介紹在 FreeBSD 中的 X 裡頭，有哪些不同的桌面環境。 “桌面環境”範圍很廣，從簡單的 window manager 到 完整的桌面應用程式，例如 KDE 或 GNOME。

### 5.7.1. GNOME

#### 5.7.1.1. 關於 GNOME

GNOME is a user-friendly desktop environment that enables users to easily use and configure their computers. GNOME includes a panel (for starting applications and displaying status), a desktop (where data and applications can be placed), a set of standard desktop tools and applications, and a set of conventions that make it easy for applications to cooperate and be consistent with each other. Users of other operating systems or environments should feel right at home using the powerful graphics-driven environment that GNOME provides. More information regarding GNOME on FreeBSD can be found on the FreeBSD GNOME Project's web site. The web site also contains fairly comprehensive FAQs about installing, configuring, and managing GNOME.

#### 5.7.1.2. Installing GNOME

可透過 package 或 Ports Collection 的方式來輕鬆安裝：

透過網路利用 package 安裝 GNOME：

`#` `pkg_add -r gnome2`

從 ports tree 透過原始碼編譯安裝 GNOME：

`#` `cd /usr/ports/x11/gnome2` `#` `make install clean`

當 GNOME 安裝完成後， 必須告訴 X server 啟動 GNOME 而非原本的 window manager。

啟動 GNOME 最簡單的方法是利 用 GDM(GNOME Display Manager)。 GDM, which is installed as a part of the GNOME desktop (but is disabled by default), can be enabled by adding `gdm_enable="YES"` to `/etc/rc.conf`. Once you have rebooted, GNOME will start automatically once you log in — no further configuration is necessary.

GNOME may also be started from the command-line by properly configuring a file named `.xinitrc`. If a custom `.xinitrc` is already in place, simply replace the line that starts the current window manager with one that starts /usr/local/bin/gnome-session instead. If nothing special has been done to the configuration file, then it is enough simply to type:

`%` `echo "/usr/local/bin/gnome-session" > ~/.xinitrc`

Next, type `startx`, and the GNOME desktop environment will be started.

### 注意:

If an older display manager, like XDM, is being used, this will not work. Instead, create an executable `.xsession` file with the same command in it. To do this, edit the file and replace the existing window manager command with /usr/local/bin/gnome-session:

`%` `echo "#!/bin/sh" > ~/.xsession` `%` `echo "/usr/local/bin/gnome-session" >> ~/.xsession` `%` `chmod +x ~/.xsession`

Yet another option is to configure the display manager to allow choosing the window manager at login time; the section on KDE details explains how to do this for kdm, the display manager of KDE.

#### 5.7.1.3. Anti-aliased Fonts with GNOME

X11 supports anti-aliasing via its “RENDER” extension. GTK+ 2.0 and greater (the toolkit used by GNOME) can make use of this functionality. Configuring anti-aliasing is described in 節 5.5.3, “Anti-Aliased 規格的字型”. So, with up-to-date software, anti-aliasing is possible within the GNOME desktop. Just go to Applications → Desktop Preferences → Font, and select either Best shapes, Best contrast, or Subpixel smoothing (LCDs). For a GTK+ application that is not part of the GNOME desktop, set the environment variable `GDK_USE_XFT` to `1` before launching the program.

### 5.7.2. KDE

#### 5.7.2.1. About KDE

KDE is an easy to use contemporary desktop environment. Some of the things that KDE brings to the user are:

- A beautiful contemporary desktop

- A desktop exhibiting complete network transparency

- An integrated help system allowing for convenient, consistent access to help on the use of the KDE desktop and its applications

- Consistent look and feel of all KDE applications

- Standardized menu and toolbars, keybindings, color-schemes, etc.

- Internationalization: KDE is available in more than 40 languages

- Centralized, consistent, dialog-driven desktop configuration

- A great number of useful KDE applications

KDE comes with a web browser called Konqueror, which is a solid competitor to other existing web browsers on UNIX® systems. More information on KDE can be found on the KDE website. For FreeBSD specific information and resources on KDE, consult the KDE on FreeBSD team's website.

#### 5.7.2.2. 安裝 KDE

如同 GNOME 或其他桌面管理軟體一樣， 也可以輕鬆透過 package 或 Ports Collection 來安裝：

To install the KDE package from the network, simply type:

`#` `pkg_add -r kde`

pkg_add(1) will automatically fetch the latest version of the application.

To build KDE from source, use the ports tree:

`#` `cd /usr/ports/x11/kde3` `#` `make install clean`

After KDE has been installed, the X server must be told to launch this application instead of the default window manager. This is accomplished by editing the `.xinitrc` file:

`%` `echo "exec startkde" > ~/.xinitrc`

Now, whenever the X Window System is invoked with `startx`, KDE will be the desktop.

If a display manager such as XDM is being used, the configuration is slightly different. Edit the `.xsession` file instead. Instructions for kdm are described later in this chapter.

### 5.7.3. More Details on KDE

Now that KDE is installed on the system, most things can be discovered through the help pages, or just by pointing and clicking at various menus. Windows® or Mac® users will feel quite at home.

The best reference for KDE is the on-line documentation. KDE comes with its own web browser, Konqueror, dozens of useful applications, and extensive documentation. The remainder of this section discusses the technical items that are difficult to learn by random exploration.

#### 5.7.3.1. The KDE Display Manager

An administrator of a multi-user system may wish to have a graphical login screen to welcome users. XDM can be used, as described earlier. However, KDE includes an alternative, kdm, which is designed to look more attractive and include more login-time options. In particular, users can easily choose (via a menu) which desktop environment (KDE, GNOME, or something else) to run after logging on.

To enable kdm, the `ttyv8` entry in `/etc/ttys` has to be adapted. The line should look as follows:

ttyv8 "/usr/local/bin/kdm -nodaemon" xterm on secure

### 5.7.4. XFce

#### 5.7.4.1. About XFce

XFce is a desktop environment based on the GTK+ toolkit used by GNOME, but is much more lightweight and meant for those who want a simple, efficient desktop which is nevertheless easy to use and configure. Visually, it looks very much like CDE, found on commercial UNIX® systems. Some of XFce's features are:

- A simple, easy-to-handle desktop

- Fully configurable via mouse, with drag and drop, etc.

- Main panel similar to CDE, with menus, applets and applications launchers

- Integrated window manager, file manager, sound manager, GNOME compliance module, and more

- Themeable (since it uses GTK+)

- Fast, light and efficient: ideal for older/slower machines or machines with memory limitations

More information on XFce can be found on the XFce website.

#### 5.7.4.2. Installing XFce

A binary package for XFce exists (at the time of writing). To install, simply type:

`#` `pkg_add -r xfce4`

Alternatively, to build from source, use the ports collection:

`#` `cd /usr/ports/x11-wm/xfce4` `#` `make install clean`

Now, tell the X server to launch XFce the next time X is started. Simply type this:

`%` `echo "/usr/local/bin/startxfce4" > ~/.xinitrc`

The next time X is started, XFce will be the desktop. As before, if a display manager like XDM is being used, create an `.xsession`, as described in the section on GNOME, but with the `/usr/local/bin/startxfce4` command; or, configure the display manager to allow choosing a desktop at login time, as explained in the section on kdm.

前一頁 | 上一層 | 下一頁
5.6. The X Display Manager | 起始頁 | 部 II. 一般性工作

本文及其他文件，可由此下載： ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。

若有 FreeBSD 方面疑問，請先閱讀 FreeBSD 相關文件，如不能解決的話，再洽詢 <questions@FreeBSD.org>。
關於本文件的問題，請洽詢 <doc@FreeBSD.org>。