Changing default login screen

First of all, hello to everybody. I have been using PureOS now for a few months and I am quite happy with the experience.

I have been trying to change the background, icon, etc. of the login screen, like I always tend to do, but I haven’t seem to find the correct way to do it. I followed guides/posts for Debian / GNOME, but nothing seemed to work for me.

PureOS, Kernel 4.19.0-9, GNOME 3.30.2

Any ideas? Thanks!

1 Like

I didn’t remember exactly what I had tried, so I went again with a new try:

  • Edited /usr/share/gnome-shell/theme/gnome-classic.css, the lines about:

    #lockDialogGroup {
    background: #2c001e url(resource:///org/gnome/shell/theme/noise-texture.png);
    background-repeat: repeat; 
    }
    

    with a manually selected file: url(file:///home/username/Pictures/image.png) with the needed with no-repeat and background-size and position values. But it doesn’t work.

  • I also edited the /usr/share/gdm/greeter.dconf-defaults uncommenting the lines:

    #  - Use another background
    [org/gnome/desktop/background]
    picture-uri='file:///home/username/Pictures/image.png'
    picture-options='zoom'
    

    It also doesn’t work (but I think this should affect the desktop background, not the login; strangely, though, it doesn’t seem to change my desktop background either.

EDIT:

  • In the /usr/share/gdm/dconf thre is a symbolic link to /etc/gdm3/greeter.dconf-defaults, wich shows the same commented-out lines as the greeter.dconf in /usr/share. So I tried uncomenting those as well:

    [org/gnome/desktop/background]
    picture-uri='file:///home/username/Pictures/image.png'
    picture-options='zoom'
    

    But, again, that should be regular desktop wallpaper.

There is no article on the PureOS wiki about it, but this is clearly not showing the default GNOME behaviour (or I am really missing something). Could anyone shed some light here?

I use Mint 20 and I just go to system setting then appearance and change whatever I want it to be. Do you have to go to the terminal to do everything in PureOs?

Are you using GNOME or cinnamon (Mint default)?

In the appearence settings in GNOME 3.30 you can manually change the (desktop) background image and the lock screen image, but, if locked, once you press any key you are prompted with the login screen again, which shows the default behaviour with the noise-texture.png typical in gdm (gnome display manager).

I don’t mind using the terminal, at the end of the day there are just config files! no matter how you edit them. But it seems that PureOS handles this login screen separately somewhere else and I don’t find it (nor they warn about on the wiki).

Okey, FINALLY I got the solution:

I went to the arch wiki GDM Article - 3.1 Log-in screen background image and learn that that gnome shell theme is now in a binary format.

  1. There they share an script to extract the existing GNOME Shell theme to a folder in your home directory.
  2. Then you should add the image according to the instructions (add image to directory; create a gnome-shell-theme.gresource.xml file that also refers to that image and finally editing gnome-shell.css)
  3. Then recompile the theme
  4. Copy the resulted gnome-shell-theme.gresource in /usr/share/gnome-shell directory.
  5. And restart gdm.service

Strangely it didn’t work for me, although I could compile correctly and everything. Anyway, I didn’t find the error because I found an script on their forums (reply number #4) that does it automatically and it worked for me. So easy peasy. Here are the steps:

  1. Create an script on your home directory (for example, named login-background.sh)

    nano login-background.sh

  2. Copy script content this into that file:

    #!/usr/bin/sh
    
    if [ "$IMAGE" = "" ]; then
      IMAGE=$(
        dbus-launch gsettings get org.gnome.desktop.screensaver picture-uri |
        sed -e "s/'//g" |
        sed -e "s/^file:\/\///g"
      )
    fi
    
    if [ ! -f $IMAGE ]; then
      echo "unknown IMAGE $IMAGE"
      exit 1
    fi
    
    echo ''
    echo 'using the following image as login background:'
    echo $IMAGE
    echo ''
    
    if [ -d ~/tmp ]; then
      CREATED_TMP="0"
    else
      mkdir -p ~/tmp
      CREATED_TMP="1"
    fi
    
    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
    

    Control + X to save, y to confirm.

  3. Then you should run it. But in my case it gave me a non existing directory error. In the script you can see that it tries to work on a ~/tmp/ directory. So I created it:

    mkdir tmp

    Then I actually run it again, without any errors this time (be sure to put the correct location and name of the image you want) (and be sure to be in the directory where you created the .sh script (in this example, we are still in the home user directory):

    IMAGE=/path/to/file.png sh login-background.sh

  4. Then restarting the gdm.service should be enough,

    sudo systemctl restart gdm.service

    although it worked “funky” to me until I rebooted (the box where you put the password was moving weirdly when clicking on it); so I recomend a reboot.

To sum up:

  1. Create an .sh script (copy&paste)
  2. Run it pointing to the image you want.
  3. Restart gdm (or reboot). Done.

The script already creates a backup for the gnome-shell-theme.gresource in /usr/share/gnome-shell (same name .backup), so no worries with that.

I hope it helps somebody else!

1 Like

polGZ ;
Mint 20 Ilyans (Cinnamon). OS upgrade before was a download fron the Update Mgr but latest was a Terminal install. 2 short sudo apt commands was all. I really like Mint , very forgiving for me of little intelligence.

Well, this was a thing about GNOME, the destkop enviroment, not about the distro (in fact, I copied and script from an arch user!). It would happen the same if you picked that flavour of Mint (I don’t know if they offer such thing).

I have been a long Debian user, I only tried PureOS because I like the all-open-source philosophy and wanted to check on my own what are those “privacy-focused” options where it is supposed to differ from Debian. In regards to DE’s, xfce has been my main driver for the last years, because I want the minimum packages “as possible” (but I don’t feel comfortable with just window managers, I am not that purist… lol)

Anyway, GNOME things… at least it looks good. There is something about nautilus and how integrated it looks that feels slick to me. Although this log-in thing… or not having native status icons or any kind of legacy tray… damn! I just can’t get why they made such decisions!