Answers:
方法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)
我使用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锁屏墙纸?