LightDM (简体中文) - ArchWiki

# LightDM (简体中文)

相关文章

- Display manager
- GDM
- KDM
- LXDM

翻译状态： 本文是英文页面 Lightdm 的翻译，最后翻译时间：2013-12-22，点击这里可以查看翻译后英文页面的改动。

LightDM 是一个跨桌面环境的 显示管理器 ，其目的是为X窗口系统提供一个标准的显示管理器。 它的特点有:

- 代码轻量
- 符合标准 (如 PAM, logind, 等)
- 为用户提供一个良好的界面.
- 跨桌面（用户可以使用各种各样的桌面环境）.

更多关于LightDM的特点可以在 这里找到.

## 安装

从官方软件仓库安装 lightdm . 你同样可以从AUR安装 lightdm-devel 这个分支或 lightdm-bzr .

### 用户界面

你需要为LightDM安装一个用户界面. 最常用的是 lightdm-gtk-greeter, 其中有 lightdm-gtk2-greeter 或 lightdm-gtk3-greeter. KDE 用户 可以安装 lightdm-kde-greeter, 一个基于Qt的用户界面.

其他的用户环境可以从AUR安装:

- lightdm-another-gtk-greeter: 一个支持主题的GTK3用户界面。
- lightdm-webkit-greeter: 使用Webkit的用户界面。
- lightdm-crowd-greeter: 一个让您在3D界面中选择配置文件的用户界面。
- lightdm-unity-greeter: 一个使用 Ubuntu 的 Unity 的用户界面。
- lightdm-razor-greeter: 使用 Razor-qt 桌面环境的用户界面。
- lightdm-pantheon-greeter: 来自 ElementaryOS Project 的用户界面。

你可以通过更改默认配置文件来更改默认用户界面:

    /etc/lightdm/lightdm.conf

    greeter-session=lightdm-yourgreeter-greeter

## 开机启动LightDM

确认lightdm 守护进程已经开机启动:

    # systemctl enable lightdm

## 命令行工具

LightDM提供一个命令行工具, `dm-tool`。想要知道用法，请在终端输入:

    $ dm-tool --help

## 测试

首先, 使用Pacman安装xorg-server-xephyr.

然后,在X测试程序下测试LightDM:

    $ lightdm --test-mode --debug

## 配置和调整

某些用户界面拥有自己的配置文件。例如lightdm-gtk3-greeter有:

    /etc/lightdm/lightdm-gtk-greeter.conf

lightdm-kde-greeter有:

    /etc/lightdm/lightdm-kde-greeter.conf

在"KDE配置"一节有更好的说明。

LightDM可以直接修改它的配置文件，或者使用`lightdm-set-defaults`程序，它可以在`/usr/lib/lightdm/lightdm/`找到。想知道一些可选的选项，执行:

    $ man lightdm-set-defaults

这个程序可以修改LightDM的配置，但是更多的选项不是使用lightdm-set-defaults修改而是需要修改配置文件。

### 更改背景

如果您想使用一个纯色（非图片）的背景，可以简单地将背景设置为十六进制数据。

例如: background=#000000

如果你想用图像来代替，请看下文。

#### GTK+用户界面

需要在使用界面上使用自定义图片，请修改`/etc/lightdm/lightdm-gtk-greeter.conf`中的background定义.

例如:

    background=/usr/share/pixmaps/black_and_white_photography-wallpaper-1920x1080.jpg

#### Unity用户街边

如果使用的是lightdm-unity-greeter，请修改`/usr/share/glib-2.0/schemas/com.canonical.unity-greeter.gschema.xml`，然后执行:

    # glib-compile-schemas /usr/share/glib-2.0/schemas/

可以参考这个页面.

Note: 注：最好将PNG或JPG文件放在`/usr/share/pixmaps`，以便于LightDM读取之。

#### KDE用户界面

在系统设置>登录界面(LightDM)中设置你的主题与图片。

### 改变你的头像

#### The .face way

Users wishing to customize their image on the greeter screen need to place an PNG image called `.face` or `.face.icon` in their home directory. Make sure it can be read by LightDM.

Note: As of December 2013, some people have issues where the icon file does not get picked up. The preferred way is to install accountsservice and use the following AccountsService way.

#### The AccountsService way

The .face way is known to cause issues, fortunately LightDM is able to automatically use AccountsService if it is installed. AccountsService files need to be set up as follows:

- A user file named after your user in `/var/lib/AccountsService/users/johndoe` containing:

    [User]
    Icon=/var/lib/AccountsService/icons/johndoe

- A 96x96 PNG icon file in `/var/lib/AccountsService/icons/johndoe`

#### Sources of Arch-centric 64x64 Icons

The archlinux-artwork package from the AUR contains some nice examples that install to `/usr/share/archlinux/icons` and that can be copied to `/usr/share/icons/hicolor/64x64/devices` as follows:

    # find /usr/share/archlinux/icons -name "*64*" -exec cp {} /usr/share/icons/hicolor/64x64/devices \;

After copying, the archlinux-artwork package can be removed.

### Enabling Autologin

Edit the LightDM configuration file and change these lines to:

    /etc/lightdm/lightdm.conf

    autologin-user=USERNAME
    autologin-user-timeout=0

or execute:

    # /usr/lib/lightdm/lightdm/lightdm-set-defaults --autologin=USERNAME

LightDM goes through PAM even when `autologin` is enabled. You must be part of the `autologin` group to be able to login without entering your password:

    # groupadd autologin
    # gpasswd -a USERNAME autologin

Note: GNOME users, and by extension any gnome-keyring user will have to set up a blank password to their keyring for it to be unlocked automatically.

### Hiding system and services users

To prevent system users from showing-up in the login, install the optional dependency accountsservice, or add the user names to `/etc/lightdm/users.conf` under `hidden-users`. The first option has the advantage of not needing to updated the list when more users are added or removed.

### Migrating from SLiM

Move the contents of xinitrc to xprofile, removing the call to start the window manager or desktop environment.

### NumLock ON

Install the numlockx package and the edit `/etc/lightdm/lightdm.conf` adding the following line:

    greeter-setup-script=/usr/bin/numlockx on

### User switching

LightDM supports user switching under a number of different desktop environments. To enable user switching it is necessary to create a symlink:

    # ln -s /usr/lib/lightdm/lightdm/gdmflexiserver /usr/local/bin/gdmflexiserver

For an alternative method see the XScreenSaver#Lightdm article.

### Default Session

Lightdm, like other DMs, stores the last-selected xsession in `~/.dmrc`. See Display manager#Session_list for more info.

## Troubleshooting

If you encounter consistent screen flashing and ultimately no lightdm on boot, ensure that you have defined the greeter correctly in lightdm's config file. And if you have correctly defined the GTK greeter, make sure the `xsessions-directory` (default: `/usr/share/xsessions`) exists and contains at least one .desktop file.

### Power menu (restart, poweroff etc.) not available

If you have installed lightdm before lightdm-1:1.6.0-6, you might have been struck by this bug: FS#36613, to fix it run:

    # chown polkitd:root /usr/share/polkit-1/rules.d

### Wrong locale displayed

In case of your locale not being displayed correctly in Lightdm add your locale to `/etc/environment`

     LANG=pt_PT.utf8

### Xresources not being parsed correctly

LightDM has an upstream bug where your Xresources file will not be loaded with a pre-processor. In practical terms, this means that variables set with `#define` are not expanded when called later. You may see this reflected as an all-pink screen if using a custom color set with urxvt. To fix it, edit `/etc/lightdm/Xsession` and search for the line:

    xrdb -nocpp -merge "$file"

Change it to read:

    xrdb -merge "$file"

Your Xresources will now be pre-processed so that variables are correctly expanded.

## See Also

- Ubuntu Wiki article
- Gentoo Wiki article
- Launchpad Page
- LightDM blog

Category:

- Display managers (简体中文)