Where is the login screen wallpaper for GDM stored?

7,120

Solution 1

Are you using Unity or Gnome?

You seem to refer to the "noise" background of gnome-shell gdm login - if it is this one it's build somehow by adding the file /usr/share/gnome-shell/theme/noise-texture.png with a grey background ... I think it's in /usr/share/gnome-shell/theme/gnome-shell.css:

background: #2e3436 url(noise-texture.png);

Solution 2

(Tested on Ubuntu Gnome Shell 16.04+)

Two ways. If you want to know what exactly you are doing, follow Solution #1. If you want a single script to do all for you, follow Solution #2 (All it does it automate Solution #1)

Solution 1

Background Info: Gnome Login Background is not a parameter which you can change directly(Wierd!). Its present within Gnome Shell CSS file which is present in binary file. Hence you have to extract binary file, modify it and replace new binary with old file.

Step1: Extracting Gnome shell binary file

Run the following script extractgst.sh to extract Gnome shell theme to ~/shell-theme directory

#!/bin/sh

workdir=${HOME}/shell-theme
if [ ! -d ${workdir}/theme ]; then
  mkdir -p ${workdir}/theme
fi
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource

for r in `gresource list $gst`; do
        gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}
done

Step2: Modifying contents

  • Copy your background image to this folder ~/shell-theme/theme.
  • Create ~/shell-theme/theme/gnome-shell-theme.gresource.xml with content.
  • Replace filename with your background image filename
  • Now, open the gnome-shell.css file in the directory and change the #lockDialogGroup definition as follows:

    #lockDialogGroup { background: #2e3436 url(filename); background-size: [WIDTH]px [HEIGHT]px; background-repeat: no-repeat; }

Set filename to be the name of the background image and background-size to your resolution.

Step3: Create new binary and replacing existing

Inside theme directory, run

glib-compile-resources gnome-shell-theme.gresource.xml

You will get a binary file. Copy it to

/usr/share/gnome-shell

Now restart GDM using

service gdm restart

If it doesnt work or got stuck, restart your computer to see your new login wallpaper :))

Solution 2

Ok, as promised, there is a simpler way to automate all this. Simply save this script as 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 '<?xml version="1.0" encoding="UTF-8"?>
<gresources>
  <gresource prefix="/org/gnome/shell/theme">' >"${GSTRES}.xml"
for r in `ls *.*`; do
  echo "    <file>$r</file>" >>"${GSTRES}.xml"
done
echo '  </gresource>
</gresources>' >>"${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

Run the script using

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

Now restart gdm using service gdm restart or restart laptop for your new login background :))

References: https://wiki.archlinux.org/index.php/GDM

https://bbs.archlinux.org/viewtopic.php?id=197036

Share:
7,120
genepool
Author by

genepool

Updated on September 18, 2022

Comments

  • genepool
    genepool over 1 year

    In 14.04, there is a really nice sort of stone texture to the background of the login screen. Where does that texture live on the disk? I have searched the unity greeter packages.

    enter image description here

    • Jason Southwell
      Jason Southwell over 9 years
      Are you referring to the purple wallpaper?
    • genepool
      genepool over 9 years
      No. It's kinda dark gray stone.
    • Jason Southwell
      Jason Southwell over 9 years
      Next time please check which variant of Ubuntu you are referring to. Ubuntu Gnome is what you're using in this case, but initially I thought you had Ubuntu proper.
  • Eliah Kagan
    Eliah Kagan over 9 years
    While I do think this answers the question (and I certainly don't think this needs to be removed or converted to a comment), I'd suggest expanding it to explain what each of those directories is for.
  • Admin
    Admin about 8 years
    Not so on 16.04...
  • mac
    mac about 7 years
    @BharadwajRaju Check my answer for 16.04+