更改lightdm-gtk-greeter背景?


1

我像疯子一样一直在谷歌搜索,试图找到答案,所以我现在决定在这里提问。

如何更改登录屏幕的背景?(lightdm-gtk-greeter)。
当前,它使用我设置为桌面背景的任何背景,并且不监听中的任何配置/etc/lightdm/lightdm-gtk-greeter.conf,这是当前设置为:

[greeter]
background=/home/illidan/Pictures/bg.png

Answers:


0

方法1:假设您正在运行<= 14.0.4,

sudo su
xhost +SI:localuser:lightdm
su lightdm -s /bin/bash
gsettings set com.canonical.unity-greeter draw-user-backgrounds 'true'
gsettings set com.canonical.unity-greeter background 'path-to-image'

为我工作。另外,您可能需要更改644背景。

方法2

将图片文件复制到此位置

/usr/share/backgrounds/

将文件名更改为 warty-final-ubuntu.png

(图片显然必须是PNG)


尝试了两种方法,先尝试了第二种方法,但是没有用。然后我进入第一个,并得到“没有这样的模式'com.canonical.unity-greeter'”
realsub

您正在运行哪个版本的Ubuntu?因为这两种方法对我而言都适用于14.0.4。(从字面上看,我只是尝试了它们)
Android开发

运行14.04LTS。抱歉,忘了提及我也用xfce代替了unity。
realsub

0

我使用Nautilus导航到墙纸文件,然后调用自定义脚本来同时设置登录屏幕和锁定屏幕背景:

#!/bin/bash

## Set login wallpaper

# strip new line char passed by Nautilus
FILENAME=$(echo $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS | sed -e 's/\r//g')

# Multiple files can't be selected.
LINE_COUNT=$(wc -l <<< "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS")
LINE_COUNT=$((LINE_COUNT-1))

if [[ $LINE_COUNT > 1 ]] ; then
    zenity --error --text "Ony one file can be selected at a time! "
    exit 1
fi

# Object type must be "file..." (ie no directories, etc.)
if [ -d "${FILENAME}" ] ; then
    zenity --error --text "$FILENAME is a directory!";
    exit 1
else
    if [ -f "${FILENAME}" ]; then
        : # Bash noop
    else
        zenity --error --text "${FILENAME} is not a file!";
        exit 2
    fi
fi

# Build working file in /tmp
echo "[com.canonical.unity-greeter]" > /tmp/set-login-wallpaper.tmp
echo "draw-user-backgrounds=false" >> /tmp/set-login-wallpaper.tmp
echo "background='$FILENAME'" >> /tmp/set-login-wallpaper.tmp

# Must run as sudo
if [ "$EUID" -ne 0 ] ; then

    # Get sudo password
    PASSWORD=$(zenity --password --title="Set Login Wallpaper" --timeout=20)

    # copy working file to real file using sudo
    echo $PASSWORD | sudo -S cp /tmp/set-login-wallpaper.tmp \
/usr/share/glib-2.0/schemas/10_unity_greeter_background.gschema.override

    # compile using sudo
    echo $PASSWORD | sudo -S glib-compile-schemas /usr/share/glib-2.0/schemas

else
    # Already sudo so simply copy and compile
    # copy working file to real file
    cp /tmp/set-login-wallpaper.tmp \
/usr/share/glib-2.0/schemas/10_unity_greeter_background.gschema.override

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

exit 0

完整的答案,包括如何向Nautilus添加脚本:如何更改Unity锁屏墙纸?

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.