1

I've been Googling like a maniac trying to find an answer, so I've now decided to ask here.

How do I go about changing the background of the login screen? (lightdm-gtk-greeter).
It currently uses whatever background I set as desktop background, and doesn't listen to any configuration in the /etc/lightdm/lightdm-gtk-greeter.conf, this is what it's currently set to:

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

Method 1: Assuming you're running <=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'

Worked for me. Also, you might need to chmod 644 your background.

Method 2

Copy the picture file to this location

/usr/share/backgrounds/

Change the file name to warty-final-ubuntu.png

(The image must be a PNG obviously)

  • Tried both methods, tried the second one first but it didn't work. Then I moved onto the first one and got "No such schema 'com.canonical.unity-greeter'" – realsub Mar 28 '16 at 21:21
  • What version of Ubuntu are you running? Because both methods work fine on 14.0.4 for me. (Literally, I just tried them) – Android Dev Mar 28 '16 at 22:51
  • Running 14.04LTS. Sorry, forgot to mention I've also replaced unity with xfce. – realsub Mar 28 '16 at 23:01
0

I use Nautilus to navigate to wallpaper file and then invoke a custom script to set the login screen and lock screen background simultaneously:

#!/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

Full answer including how to add a script to Nautilus: How to change the Unity lockscreen wallpaper?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.