13.2. 定制图形界面

13.2.1. 选择显示管理器

The graphical interface only provides display space. Running the X server by itself only leads to an empty screen, which is why most installations use a display manager to display a user authentication screen and start the graphical desktop once the user has authenticated. The three most popular display managers in current use are gdm3 (GNOME Display Manager), sddm (suggested for KDE Plasma) and lightdm (Light Display Manager). Since the Falcot Corp administrators have opted to use the GNOME desktop environment, they logically picked gdm3 as a display manager too. The /etc/gdm3/daemon.conf configuration file has many options (the list can be found in the /usr/share/gdm/gdm.schemas schema file) to control its behaviour while /etc/gdm3/greeter.dconf-defaults contains settings for the greeter “session” (more than just a login window, it is a limited desktop with power management and accessibility related tools). Note that some of the most useful settings for end-users can be tweaked with GNOME’s control center.

13.2.2. 选择窗口管理器

Since each graphical desktop provides its own window manager, which window manager you choose is usually influenced by which desktop you have selected. GNOME uses the mutter window manager, Plasma uses kwin, and Xfce (which we present later) has xfwm. The Unix philosophy always allows using one’s window manager of choice, but following the recommendations allows an administrator to best take advantage of the integration efforts led by each project.

回到基础 窗口管理器

The window manager displays the “decorations” around the windows belonging to the currently running applications, which includes frames and the title bar. It also allows reducing, restoring, maximizing, and hiding windows. Most window managers also provide a menu that pops up when the desktop is clicked in a specific way. This menu provides the means to close the window manager session, start new applications, and in some cases, change to another window manager (if installed).

Older computers may, however, have a hard time running heavyweight graphical desktop environments. In these cases, a lighter configuration should be used. “Light” (or small footprint) window managers include WindowMaker (in the wmaker package), Afterstep, fvwm, icewm, blackbox, fluxbox, or openbox. In these cases, the system should be configured so that the appropriate window manager gets precedence; the standard way is to change the x-window-manager alternative with the command update-alternatives --config x-window-manager.

DEBIAN 特性 选择

Debian 政策列出了一系列标准命令来运行特殊命令。例如, x-window-manager 唤起窗口管理器。但是Debian 并没用将该命令指派给某个固定的窗口管理器。管理员可以选择唤起哪个管理器。

对于每种窗口管理器,相关软件包会注册 x-window-manager 命令选项连同一个相关的优先级。通过管理员显示指定,该优先级允许挑选最优的窗口管理器。

注册命令和显示配置都会唤起 update-alternatives 脚本。运行 update-alternatives --config *symbolic-command*会选择符号链接所指向的命令。 update-alternatives 脚本创建(并维护) /etc/alternatives/ 目录中的符号链接,他们反过来关联执行文件位置。随着时间的推移,软件包被安装或者卸载,或者管理员改变了配置。如果提供备选项的软件包被移除了,在剩余命令中备选项就会被自动降级。

Debian 政策中并没有列出所有的符号命令;有些Debian 软件包的维护者故意选择这种并不直接的机制,它提供了很有趣的灵活性(例子包括 x-www-browserwww-browserccc++awk,等)。

13.2.3. 菜单管理

Modern desktop environments and many window managers provide menus listing the available applications for the user. In order to keep menus up-to-date in relation to the actual set of available applications, each package usually provides a .desktop file in /usr/share/applications. The format of those files has been standardized by FreeDesktop.org:

https://standards.freedesktop.org/desktop-entry-spec/latest/

The applications menus can be further customized by administrators through system-wide configuration files as described by the “Desktop Menu Specification”. End-users can also customize the menus with graphical tools such as kmenuedit (in Plasma), alacarte (in GNOME) or menulibre.

https://standards.freedesktop.org/menu-spec/latest/

历史 Debian 菜单系统

Historically — way before the FreeDesktop.org standards emerged — Debian had invented its own menu system where each package provided a generic description of the desired menu entries in /usr/share/menu/. This tool is still available in Debian (in the menu package) but it is only marginally useful since package maintainers are encouraged to rely on .desktop files instead.