LightDM doesn't show the user background

Do you have a cleaner solution (besides checking every few seconds rather than constantly)? I’ve been looking for some documentation to setup an event listener with dbus in bash or Python but couldn’t find relevant informations.

Just in case somebody uses my script, I’ve noticed a bug in it. Here is a small update (that would also fix another issue specific to Ubuntu MATE 17.10):

#!/bin/bash

function setuserbackground(){
	export USERBACKGROUND=`gsettings get org.mate.background picture-filename | tail -c +2 | head -c -2`
	dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.Accounts /org/freedesktop/Accounts/User`id -u` org.freedesktop.Accounts.User.SetBackgroundFile string:"$USERBACKGROUND"
}

setuserbackground

dbus-monitor --profile "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/mate/desktop/background/'" |
while read -r line; do
	setuserbackground
done

The change is in the line that sets the USERBACKGROUND variable: it would remove single quotes in the whole path and thus wouldn’t work with wallpapers that have one. As for UM 17.10, it seems that bash changed the gsettings output to being between double quotes instead of single ones. The command now removes the first and last characters (the quotes) rather than quotes in the path.

New version of my script to be compatible with the new way LightDM handles user backgrounds starting with Ubuntu MATE 18.04:

#!/bin/bash
#
# Sets the following:
# [org.freedesktop.DisplayManager.AccountsService]
# BackgroundFile
# [User]
# Background
# in /var/lib/AccountsService/users/$USER

function setuserbackground(){
	export USERBACKGROUND=`gsettings get org.mate.background picture-filename | tail -c +2 | head -c -2`

	dbus-send --system --print-reply \
	--dest=org.freedesktop.Accounts \
	--type=method_call \
	/org/freedesktop/Accounts/User`id -u` \
	org.freedesktop.Accounts.User.SetBackgroundFile string:"$USERBACKGROUND"

	dbus-send --system --print-reply \
	--dest=org.freedesktop.Accounts \
	/org/freedesktop/Accounts/User`id -u` \
	org.freedesktop.DBus.Properties.Set \
		string:org.freedesktop.DisplayManager.AccountsService \
		string:BackgroundFile \
		variant:string:"$USERBACKGROUND"
}

setuserbackground

dbus-monitor --profile "type='signal',interface='ca.desrt.dconf.Writer',path='/ca/desrt/dconf/Writer/user',arg0path='/org/mate/desktop/background/'" |
while read -r line; do
	setuserbackground
done

I’ve put a deb on a Dropbox account if you want to install/uninstall it easily: https://www.dropbox.com/s/zmf5sf7t11v0zdv/msd-background-helper_0.7_all.deb?dl=0

It’s probably badly made and might trigger Lintian errors but it works. Before installing it, delete the script in /usr/bin and the .desktop in /etc/xdg/autostart if you used the previous version.

I wanted to create a script that would apply the Nitrogen background to the display manager. Your script helped me accomplish this, more than any other resource I could find. You can find it at this little github repo of mine:

It also has a script to apply changes to gtk 2 cursor, gtk, and icon themes to other relevant places, since LXAppearance doesn't seem to do all that I want.

I'm using these as part of an Openbox enviornment that I'm setting up for myself.

Hi, is there any fix for this issue other than using the script?

What process/application is involved in setting the background and what is supposed to update /var/lib/AccountsService/users/<username> file? As mentioned, this lightdm background change works fine in Xfce. I could see each time I change background, the BackgroundFile key is updated from within Xfce but not when in MATE.

[org.freedesktop.DisplayManager.AccountsService]
BackgroundFile='/usr/share/backgrounds/ubuntu-mate-groovy/groovy-gorilla-green.jpg'

The mate settings daemon background 'active' key is enabled.

sai@sai-HP-Laptop-14-bs0xx:~$ gsettings get org.mate.SettingsDaemon.plugins.background active
true

What is it that is missing in MATE?

In Groovy Gorilla, I assume you should modify this setting in dconf-editor to edit the background in the new Arctica Greeter.


and this one to draw user backgrounds:

Basically, LightDM checks for a specific key in dconf for the background image to display. The settings daemon in GNOME, XFCE and others set that key whenever the user's background is changed to reflect it. MATE's settings daemon doesn't.

@Utsuro, at the time of writing, I was using slick-greeter. Had changed to it for experimenting and did not know about this dconf thing). After reading your msg, I reverted back to arctica-greeter. I changed values as suggested but no luck.

In fact, I would say it is worse than slick-greeter in that, the background value set in accountsservice user file is not used. It overrides that entry with its own defaults. If we use 'lightdm-settings' (login window) for slick-greeter or 'lightdm gtk+ settings' for lightdm-gtk-greeter, the changes made creates a .conf file in /etc/lightdm. With arctica-greeter however, a file already exists (/etc/lightdm/lightdm.conf.d/90-arctica-greeter.conf) which does not get updated with changes made using dconf-editor! So now, the dconf settings have my custom changes but the conf file only has the defaults, with the behavior of lightdm guided by default file.

This may be some quirk with arctica but in general, with any greeter, the 'use user background' option even when set, is not honored in MATE.

1 Like

@terzag, welcome back!

Which key is are you referring to? picture-uri? or picture-filename as it is called in MATE? Xfce doesn't seem to have any such, specific to it's desktop. What is it updating then?

From your postings and some linked discussions on NixOS and LinuxMint, it seems LightDM is looking only at /var/lib/Accountsservice/users/. The BackgroundFile (as you have updated your script) value is the one that is shown on login screen. But what program updates that value? In Xfce is it thunar? or xfce4-settings? In MATE is it Caja? or mate-settings-daemon?

On my PC, when I search for 'settings', there are gnome-settings-daemon, mate-settings-daemon, xfce4-settings, ubuntu-mate-default-settings. Of these, I do not know which are default install and which got installed as dependency for other programs I might have installed. Could there be some conflicts causing accountsservice file not getting updated?

Oh yeah, sorry, I misremembered. It's been a long time since I've done that script.

LightDM is actually looking at a file (through Accountsservice) and my script monitors the changes in the background through dbus/dconf to update said file.

From what I understood when looking into this, it's pretty specific to Ubuntu (and derivatives like Mint). I think on Unity it was gnome-settings-daemon that was patched to do the same behaviour (since Ubuntu moved to GNOME 3, LightDM has been replaced by GDM, so I don't think the feature exists anymore). Not sure what monitors background changes on XFCE.

So, mate-settings-daemon would need to be updated to "plug" into Accountsservice or whatever but IIRC, since it's specific to Ubuntu, it's out of the scope of the MATE project and won't be implemented. I guess it would need to be patched and maintained for Ubuntu MATE specifically.

PS: I don't use Ubuntu MATE anymore (switched to XFCE), so if my script doesn't work anymore, feel free to update it if you can figure what needs to be changed but I won't update it myself.