gnome自定义锁屏背景

来源链接

一种较为简便的方法

首先建立一个脚本文件

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

将这个文件命名为login-background.sh

然后确定好要设置的图片的路径,

(假设图片的路径是~/Bat.jpg)

在脚本文件所在的路径下,执行以下命令

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

然后重启电脑,或者重启gnome,注意要先保存你工作状态,将软件正常关闭。

重启gnome:

service gdm restart

你可能感兴趣的:(gnome自定义锁屏背景)