10

I've been using Debian for the first during the last week, and I've managed to configure some desktop options with the gnome-tweak-tools, but I am stuck trying to customize the login screen.

During the research I've done I've found a lot of information about doing this things in Ubuntu, Linux Mint or Arch Linux, but not much information about the "Debian way".

I think, Gnome uses Debian-gdm user's configuration for the login screen, but I don't know how to actually change it, I've tried to change it with gnome-tweak-tools, as any other user, and I've tried also editing the "/etc/gdm3/greeter.dconf-defaults" file configuration, addind the path to the file I want as background in the "picture-uri" line. "picture-options_'none'" seems also to do nothing.

Which is the easiest way to customize it?

I'm using gnome-shell version 3.14.4 and debian version 8.6

  • Am I missing something obvious? If you just want to change the background image, there should be a setting. (Although I can't test it as I am using a newer GNOME version) – lw1.at Sep 21 '16 at 16:37
5

(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 (weird!). It's 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 it

  • Copy your background image to this folder ~/shell-theme/theme.
  • Create file ~/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 Gnome shell theme 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 doesn't 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

  • I dont get gnome-shell-theme.gresource.xml file while all the rest are there... Why? I have Gnome 3.22. – 71GA Nov 11 '17 at 11:29
4

After a few more researching and some testing later, I finally have changed my login background, those are the steps I followed:

1) I've placed the file I wanted as background in /usr/share/pictures directory (I've created that directory myself)

2) I've entered the terminal and, as root user, I've edited /etc/gdm3/greeter.dconf-defaults file in order to look like this:

[org/gnome/desktop/background]
picture-uri='file:///usr/share/Pictures/background.png'
picture-options='zoom'

[org/gnome/login-screen]
logo='/usr/share/icons/gnome/48x48/places/debian-swirl.png'
fallback-logo='/usr/share/icons/gnome/48x48/places/debian-swirl.png'
disable-user-list=true
disable-restart-buttons=true

(background.png is my actual background picture)

3) In order to regenerate the configuration I ran "dpkg-reconfigure gdm3" and "dpkg-reconfigure gdebi-core"

  • 1
    This crashed my X session on startup, fixed it by undoing the changes in a console though :) – Maarten Nov 8 '16 at 15:53
  • Warning! This solution will crash your system regardles if it is officially described on a Debian Wiki: wiki.debian.org/GDM Evaluation: It looks like Debian has a hard time keeping their Wiki up to date. If Debian wants to become the best GNU/Linux OS (which in my opinion already is) it only needs to redesign it's wiki to be more user friendly (HTML5 / CSS 3.0 / databases). To new users it must never happen that officially described solution crashes their system. This is crucial as it will turn them away from Linux... And we don't want that... – 71GA Oct 31 '17 at 7:02
1

Probably the simplest solution by now is to use the following application: https://github.com/juhaku/loginized. NOTE: I'm the author of this application.

It is GNOME GDM Login Theme Manager which allows you to change login theme and the background image as well. There might be also more features upcoming to the application.

0

Some tests on another system (SL7.4) showed problems.

"extractgst.sh" doesn't generate "gnome-shell-theme.gresource.xml", which should be edited in step 2 of solution 1. If you add the ".xml" file generation of solution 2, you will have the "xml" file needed for inspection.

Solution 2 script uses "$CREATED_TMP", which has never been defined. Please delete the complete "if"-statement.

Be careful with using sudo with the scripts. Change to root with "/bin/su -" and run, what seems to be needed for the script by hand first.

Now come the special problems with SL7 (Centos/RHEL7 clone). SL7 uses SELinux together with its audit part to generate system security. If system files as here are changed by a script, SELinux doesn't know about them and forbids usage of those files, it has no information about, what results in a black background at login. This can be corrected by using the "restorecon" command recursively for this directory. After logging out you will get the wanted login-screen-background.

Added: restorecon should be done for "/usr/share/gnome-shell", because this is the resource directory. It may be, it will make sense to execute restorecon for the gnome directories for the user, if problems still exist. But for me everything is working well for now.

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.