Display manager (简体中文)

翻译状态: 本文是英文页面 Display_manager翻译,最后翻译时间:2015-7-27,点击这里可以查看翻译后英文页面的改动。

显示管理器或登录管理器是一个在启动最后显示的图形界面。和窗口管理器一样,显示管理器有很多种。通常每个显示管理器都能进行一些定制。

显示管理器列表

注意: 如果使用 桌面环境,应该尽量使用对应的显示管理器。

控制台

  • CDM: 控制台显示管理器 (available in the AUR: cdm-gitAUR)
  • Console TDM — Extension for xinit written in pure Bash.
http://code.google.com/p/t-display-manager/ || console-tdmAUR

Graphical

  • Entrance — An EFL based display manager, highly experimental.
http://enlightenment.org/ || entrance-gitAUR
https://github.com/linuxmint/mdm || mdm-display-managerAUR
  • SDDM:基于QML的显示管理器并继承于KDE4的KDM,适用于Plasma。https://github.com/sddm/sddmsddm
  • SLiM: 简单登录管理器 (slim)
    Warning: slim登录管理器已经停止开发,不推荐使用
  • wdm: WINGs 显示管理器 (wdmAUR)
  • XDM — X 显示管理器支持XDMCP, host chooser.
http://www.x.org/archive/X11R7.5/doc/man/man1/xdm.1.html || xorg-xdm

加载显示管理器

通过启动登录管理器(或称显示管理器),即可进行图形界面登录。目前,Arch 提供了 GDMKDMSLiMXDMLXDMLightDMsddm 的 systemd 服务文件。以 KDM 为例,配置开机启动:

# systemctl enable kdm.service

执行上述命令后,登录管理器应当能正常工作了。如果不是的话,很可能是因为你修改了default.target。默认情况应当如下:

# ls -l /etc/systemd/system/default.target
/etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target

删除被修改的 default.target 即可,systemd 会自动使用默认配置(即 graphical.target):

# rm /etc/systemd/system/default.target

使用 systemd-logind

可使用 loginctl 来查看用户会话的状态。所有 PolicyKit 操作,如挂起系统、挂载外部驱动器,都无需配置即可使用。

$ loginctl show-session $XDG_SESSION_ID

疑难解答

第二次注销时崩溃

切换到 Systemd 之后,有些显示管理器会在第二次注销时崩溃。需要在配置文件中加入 pam,下面是 sddm 的示例:

/etc/pam.d/sddm
...
session 	required 	pam_systemd.so


提示和技巧

会话列表

Many display managers read available sessions from /usr/share/xsessions/ directory. It contains standard desktop entry files for each DM/WM.

To add/remove entries to your display manager's session list; create/remove the .desktop files in /usr/share/xsessions/ as desired. A typical .desktop file will look something like:

[Desktop Entry]
Encoding=UTF-8
Name=Openbox
Comment=Log in using the Openbox window manager (without a session manager)
Exec=/usr/bin/openbox-session
TryExec=/usr/bin/openbox-session
Icon=openbox.png
Type=XSession

没有窗口管理启动应用程序

You can also launch an application without any decoration, desktop, or window management. For example to launch google-chromeAUR create a web-browser.desktop file in /usr/share/xsessions/ like this:

[Desktop Entry]
Encoding=UTF-8
Name=Web Browser
Comment=Use a web browser as your session
Exec=/usr/bin/google-chrome --auto-launch-at-startup
TryExec=/usr/bin/google-chrome --auto-launch-at-startup
Icon=google-chrome

In this case, once you login, the application set with Exec will be launched immediately. When you close the application, you will be taken back to the login manager (same as logging out of a normal DE/WM).

It is important to remember that most graphical applications are not intended to be launched this way and you might have manual tweaking to do or limitations to live with (there is no window manager, so do not expect to be able to move or resize any windows, including dialogs; nonetheless, you might be able to set the window geometry in the application's configuration files).

See also xinitrc#Starting applications without a window manager.

自动启动

Most of display managers sources /etc/xprofile, ~/.xprofile and /etc/X11/xinit/xinitrc.d/. For more details, see xprofile.

设置语言

For display manager's that use AccountsService the display manager locale can be set by editing /var/lib/AccountsService/users/$USER:

[User]
Language=your_locale

where your_locale is a value such as en_GB.UTF-8.

Restart your display manager for the changes to take effect.

已知问题

不兼容在systemd

Affected DMs: Entrance, MDM

Some display managers are not fully compatible with systemd, because they reuse the PAM session process. It causes various problems on second login, e.g.:

  • NetworkManager applet does not work,
  • PulseAudio volume cannot be adjusted,
  • login failed into GNOME with another user.