Sunday, 23 October 2011

Modifying Gnome3 Login Background

I recently started using Gnome3 and found that it is seriously lacking in configuration utilities.  While this is a problem for simplicity, you can still achieve most customisations through brute force.  One of the most common customisations I have seen many requests for on Google, is that of customising the GDM3 login screen background.

The easiest way to understand how the login background can be modified, is to think of the login screen as a Gnome session, but with a different interface to that of the gnome-shell.  The active user for the Gnome login screen is the GDM user.  On Debian this user is Debian-gdm.  So in order to modify the login screen background, you in fact need to modify the Debian-gdm user's gconf settings, updating the path to the desired wallpaper.

Its a fairly straight forward task, but is made complicated by the fact that the Debian-gdm user does not have a login shell defined in /etc/passwd and cannot be used as a valid user from the GDM login screen.  So in order to access and modify the Debian-gdm user's gconf settings, you must switch to this user using the su command from a root login shell.

root# su - Debian-gdm -s /bin/bash
Debian-gdm$ 

Now, gconf settings are modified through the dconf subsystem using DBus.  So to enable access to the DBus interface, you need to launch a DBus daemon for the Debian-gdm user and import it into the environment:

Debian-gdm$ $(dbus-launch | sed 's/^/export /g')

Next you need to start the dconf-service that interfaces with DBus and provides the backend for gconf.

Debian-gdm$ ps -eao user,command | awk '("'${USER:-$LOGNAME}'" == $1 && $NF ~ /^\/usr\/lib\/d-?conf\/dconf-service/) { print $NF }'

Running the above command will print the username and command line of the running dconf-service if there is one.  If the dconf-service isn't running, then start it.

Debian-gdm$ /usr/lib/d*conf/dconf-service &

Now you can access the gconf settings for Debian-gdm through the gsettings utility.

Debian-gdm$ gsettings get org.gnome.desktop.background picture-uri

Don't forget picture-uri is a URI, so be sure to prefix it with file:// or http://.  For all of this wrapped up into a script you can run as root, see my Google code project:

http://code.google.com/p/set-gnome3-background

No comments:

Post a Comment