gnome3(ubuntu16.04)下修改登录页面背景图片

本教程适用于ubuntu 16.04 TLS Gnome-shell 3.18.4

不知道如何查看gnome版本的在终端输入:gnome-shell --version

即可查看


新建文件名为login-background.sh脚本文件输入以下代码:

WORKDIR=~/tmp/gdm-login-background
GST=/usr/share/gnome-shell/gnome-shell-theme.gresource
GSTRES=$(basename $GST)

mkdir -p $WORKDIR
cd $WORKDIR
mkdir theme

for r in `gresource list $GST`; do
  gresource extract $GST $r >$WORKDIR$(echo $r | sed -e 's/^\/org\/gnome\/shell\//\//g')
done

cd theme
cp "$IMAGE" ./

echo "
#lockDialogGroup {
  background: #2e3436 url(resource:///org/gnome/shell/theme/$(basename $IMAGE));
  background-size: cover;
  background-repeat: no-repeat;
}" >>gnome-shell.css

echo '

  ' >"${GSTRES}.xml"
for r in `ls *.*`; do
  echo "    $r" >>"${GSTRES}.xml"
done
echo ' 

' >>"${GSTRES}.xml"

glib-compile-resources "${GSTRES}.xml"

sudo mv "/usr/share/gnome-shell/$GSTRES" "/usr/share/gnome-shell/${GSTRES}.backup"
sudo mv "$GSTRES" /usr/share/gnome-shell/

rm -r $WORKDIR

if [ "$CREATED_TMP" = "1" ]; then
  rm -r ~/tmp

fi

而后执行输入:

IMAGE=~/eg.jpg sh login-background.sh

eg.jpg即为所要更换的背景图片

最后重启gdm

service gdm restart

你可能感兴趣的:(linux)