> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/di-13-zhang-zhuo-mian-huan-jing/di-13.7-jie-gnome.md).

# 13.7 GNOME

GNOME 是一款面向用户的桌面环境。它包括用于启动应用和显示状态的面板、桌面、本地工具和应用程序，以及一套使应用程序协同工作并保持一致的设计规范。

## GNOME 桌面环境概述

> **警告**
>
> 目前因 FreeBSD Bugzilla Bug 287955 - x11/gdm: The user cannot log in; the system hangs at the login screen in gdm 47\[EB/OL]. \[2026-04-04]. <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287955>. GDM 无法正常运行，将停留在登录界面，`startx` 正常。
>
> 在虚拟机中可正常运行。

GNOME 曾是 GNU 项目的组成部分，旨在构建功能完备的桌面环境，目前主要由 Red Hat 主导开发维护。GNOME 是 Linux 和类 UNIX 系统中的主流桌面环境，设计简洁现代。GNOME 是 GNU Network Object Model Environment 的缩写，源自 GNU 项目，其首字母 G 应发音，读作 /ɡəˈnoʊm/（类似“guh-nome”）。

## 安装完整的 GNOME 桌面环境

* 使用 pkg 安装：

```sh
# pkg install xorg gnome noto-sans-sc
```

* 或使用 Ports 安装：

```sh
# cd /usr/ports/x11/xorg/ && make install clean
# cd /usr/ports/x11/gnome/ && make install clean
# cd /usr/ports/x11-fonts/noto-sans-sc/ && make install clean
```

### 软件包说明

| 软件           | 用途         |
| ------------ | ---------- |
| xorg         | X11        |
| gnome        | GNOME 主程序  |
| noto-sans-sc | 思源黑体（简体中文） |

## 配置

还需配置 procfs 文件系统的自动挂载。

需在 **/etc/fstab** 文件中添加如下内容：

```ini
proc /proc procfs rw 0 0
```

设置 D-Bus 服务开机自启：

```sh
# service dbus enable
```

设置 GDM 显示管理器开机自启：

```sh
# service gdm enable
```

执行以下命令，将 GNOME 会话命令写入 **\~/.xinitrc** 文件，以便使用命令 startx 启动 GNOME：

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

![FreeBSD GNOME](/files/4yOFQPcRDBJ4m6eDkDFQ)

默认禁止 root 登录。

![FreeBSD GNOME](/files/4y2zbFqKXP6uqDGLmhkK)

此为默认壁纸。

![FreeBSD GNOME](/files/0T52Cy34PB7RftTobtYz)

## 为 GNOME 桌面环境配置中文环境

本小节的配置参数与用户 shell 无关，即使使用 csh 也应按此方式配置。

使用文本编辑器打开 GDM 本地化配置文件 **/usr/local/etc/gdm/locale.conf**，修改语言设置。将原有内容替换如下：

```ini
LANG="zh_CN.UTF-8"         # 设置系统默认语言为简体中文 UTF-8
LC_CTYPE="zh_CN.UTF-8"     # 设置字符类型和编码为简体中文 UTF-8
LC_MESSAGES="zh_CN.UTF-8"  # 设置系统消息显示语言为简体中文 UTF-8
```

## 中文输入法

IBus、Fcitx 5 二选一即可。

### IBus

GNOME 默认使用的输入法框架是 IBus。

使用 pkg 安装：

```sh
# pkg install zh-ibus-libpinyin
```

或使用 Ports 安装：

```sh
# cd /usr/ports/chinese/ibus-libpinyin/
# make install clean
```

安装后运行初始化命令 `ibus-setup`。随后：设置 → 键盘 → 输入源，点击“添加输入源”，选择“汉语（中国）”，加入“中文（智能拼音）”。

### Fcitx 5

参见输入法相关章节。

> **警告**
>
> IBus 是 GNOME 的依赖项，即使不使用 IBus，也不能将其卸载，否则将一并卸载 GNOME。

![FreeBSD GNOME](/files/9uVosZiKsvuRp99JgQPb)

## 与常规习惯不同的设置调整

GNOME 的设计理念与部分用户的操作习惯存在差异，例如桌面不允许放置图标、右上角无系统托盘等。~~是否与垃圾桶不能有垃圾、人不能在床上、门不能关、桌子上不能放东西有异曲同工之妙？~~

### 系统优化工具

使用 pkg 安装：

```sh
# pkg install gnome-tweaks
```

或使用 Ports 安装：

```sh
# cd /usr/ports/deskutils/gnome-tweaks/
# make install clean
```

### 恢复 GNOME 顶栏的托盘图标

需要安装 Firefox 浏览器 **www/firefox** 及 Port **www/chrome-gnome-shell**。

[TopIcons Plus](https://extensions.gnome.org/extension/1031/topicons/) 已长期未更新，因此只能使用 [AppIndicator and KStatusNotifierItem Support](https://extensions.gnome.org/extension/615/appindicator-support/)。

![GNOME 恢复 GNOME 顶栏的托盘图标](/files/dZBMMdNJ7rqVzMFUyOIQ)

![GNOME 恢复 GNOME 顶栏的托盘图标](/files/wrwFy2Vdxsi0QZQTgKz4)

![GNOME 恢复 GNOME 顶栏的托盘图标](/files/t3FhiByCQyYhd6tbdgk1)

![GNOME 恢复 GNOME 顶栏的托盘图标](/files/ZLyTfyWw6zBWG3QBw87S)

![GNOME 恢复 GNOME 顶栏的托盘图标](/files/zPrJus4jY7iZ3Dou746w)

![GNOME 恢复 GNOME 顶栏的托盘图标](/files/7Lr4jEUhCcSp1gEbJuZl)

#### 参考文献

* Abhishek Prakash. Getting the Top Indicator Panel Back in GNOME\[EB/OL]. \[2026-03-25]. <https://itsfoss.com/enable-applet-indicator-gnome>. 提供了恢复 GNOME 顶栏托盘图标显示的详细步骤与扩展安装指南。

### 在桌面上放置图标

扩展 [gnome-shell-extension-desktop-icons](https://extensions.gnome.org/extension/1465/desktop-icons/) 已经长期未更新，项目地址为：[Desktop Icons](https://gitlab.gnome.org/World/ShellExtensions/desktop-icons)。

可使用 [Desktop Icons NG (DING)](https://extensions.gnome.org/extension/2087/desktop-icons-ng-ding/) 解决。安装方式同上。

![GNOME 在桌面放图标](/files/5ahqynjI9c2d2qIChzOm)

壁纸为自定义设置，其余均为默认配置。

## 桌面主题美化

FreeBSD 安装桌面环境后采用简洁风格，以下内容适用于基于 GTK 库的桌面环境。

以下收录部分图标和主题，如需获取更多资源，可访问 [FreshPorts](https://www.freshports.org)。

* GTK 桌面主题

| 主题     | 安装命令                                  |
| ------ | ------------------------------------- |
| matcha | `# pkg install matcha-gtk-themes`     |
| Qogir  | `# pkg install qogir-gtk-themes`      |
| Pop    | `# pkg install pop-gtk-themes`        |
| Flat   | `# pkg install flat-remix-gtk-themes` |
| Numix  | `# pkg install numix-gtk-theme`       |
| Sierra | `# pkg install sierra-gtk-themes`     |
| Yaru   | `# pkg install yaru-gtk-themes`       |
| Canta  | `# pkg install canta-gtk-themes`      |

* GTK 桌面图标

| 图标       | 安装命令                                    |
| -------- | --------------------------------------- |
| papirus  | `# pkg install papirus-icon-theme`      |
| Qogir    | `# pkg install qogir-icon-themes`       |
| Pop      | `# pkg install pop-icon-theme`          |
| Flat     | `# pkg install flat-remix-icon-themes`  |
| Numix    | `# pkg install numix-icon-theme`        |
| Numix 圆形 | `# pkg install numix-icon-theme-circle` |
| Yaru     | `# pkg install yaru-icon-theme`         |
| Canta    | `# pkg install canta-icon-theme`        |

### GNOME 主题美化

以下安装 [WhiteSur](https://www.pling.com/p/1403328/) 主题。

1. 下载主题源代码包：`git clone https://github.com/vinceliuice/WhiteSur-gtk-theme`
2. 进入主题包目录：`cd WhiteSur-gtk-theme`
3. 修改 shebang：编辑 `install.sh` 文件，修改第一行为 `#!/usr/local/bin/bash`，随后保存。
4. 执行安装：`bash install.sh`

### WhiteSur 图标

[图标](https://www.pling.com/p/1405756/)

1. 下载图标：`git clone https://github.com/vinceliuice/WhiteSur-icon-theme`
2. 进入软件目录：`cd WhiteSur-icon-theme`
3. 修改 shebang：编辑 `install.sh` 文件，修改第一行为 `#!/usr/local/bin/bash`，随后保存。
4. 执行安装：`bash install.sh`

### 光标

[光标](https://www.pling.com/p/1355701/)

1. 下载光标：`git clone https://github.com/vinceliuice/McMojave-cursors`
2. 进入软件目录：`cd McMojave-cursors`
3. 修改 shebang：编辑 `install.sh` 文件，修改第一行为 `#!/usr/local/bin/bash`，随后保存。
4. 执行安装：`bash install.sh`

### 思考题

按照下面的步骤，在终端安装 [Papirus 图标](https://www.gnome-look.org/p/1166289/)：

```sh
$ git clone https://github.com/PapirusDevelopmentTeam/papirus-icon-theme
$ cd papirus-icon-theme
$ ./install.sh
```

## 附录：GNOME 桌面环境精简安装

* 使用 pkg 安装：

```sh
# pkg install xorg-minimal gnome-lite wqy-fonts xdg-user-dirs
```

* 或使用 Ports 安装：

```sh
# cd /usr/ports/x11/xorg-minimal/ && make install clean
# cd /usr/ports/x11/gnome/ && make FLAVOR=lite install clean
# cd /usr/ports/x11-fonts/wqy/ && make install clean
# cd /usr/ports/devel/xdg-user-dirs/ && make install clean
```

### 软件包说明

| 包名             | 作用           |
| -------------- | ------------ |
| `xorg-minimal` | 精简版 X 图形环境   |
| `gnome-lite`   | 精简版 GNOME 桌面 |

### 精简现有的 GNOME 完整版本

如果已安装完整版本，也可使用 pkg 卸载附带的游戏软件：

```sh
# pkg delete gnome-2048 gnome-klotski gnome-tetravex gnome-mines gnome-taquin gnome-sudoku gnome-robots gnome-nibbles lightsoff tali quadrapassel swell-foop gnome-mahjongg five-or-more iagno aisleriot four-in-a-row
```

![GNOME 精简安装](/files/AsroCWX9XcfCWBVUvQIM)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/di-13-zhang-zhuo-mian-huan-jing/di-13.7-jie-gnome.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
