LightDM doesn't show the user background

Just to be sure: you simply set a picture as desktop background and it appears on the login screen, you don’t set it in the LightDM GTK+ system settings?

No. To set the desktop background I use the normal background chooser. See below:

To set the Greeter background, I use the greeter settings. See below:

Oh, ok. So that confirms it’s not my issue.

The thing is that you shouldn’t have to set the background in the LightDM GTK+ Greeter settings at all, LightDM is supposed to set the user background with the option “Use user wallpaper if available” (which is supposed to be on by default, I assume you unchecked it, or maybe it’s because of Mate’s default conf file), which overrides the background set in the configuration.

My problem is that however the settings are tweaked, the desktop background is not used instead of the LightDM background, whatever greeter is used. It works fine on Xubuntu (and probably other DEs) but not on Ubuntu Mate for reasons that are a complete mystery to me. My best guess is that LightDM is unable to get the path to the background due to the way Mate stores its settings.

Ah…right. I didn’t realise that was supposed to be a feature. I have always set the backgrounds independently, even if it was the same background being used.

I’ve just installed xubuntu-desktop on my main PC alongside Mate. After setting a desktop background in Xfce, it appears fine on the LightDM login page, so it seems to confirm that the issue is LightDM being unable to get the background file path from Mate.

Ok, I’ve found where the issue is via a similar bug in Cinnamon: mate-settings-daemon doesn’t use AccountsService, or doesn’t have a specific plugin to manage the background with it. Basically, the daemon is supposed to update the file /var/lib/AccountsService/users/username through gsettings to add/update the background in the User section. This value is then used by LightDM to fetch the user background and display it as expected.

I’ve updated a bug report I had opened on Launchpad.
EDIT: opened one too on GitHub for msd.

(cc @Wimpy)

1 Like

I’ve managed to make a script that fixes the issue. It might be a quick a dirty hack, but it works. Hopefully, the functionnality will be properly integrated in mate-settings-daemon at some point.

#!/bin/bash

function setuserbackground(){
	export USERBACKGROUND=`gsettings get org.mate.background picture-filename | tr -d "'"`
	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

Put it in /usr/bin (I called it msd-background-helper), make it executable and run it at session start. You can put the following msd-background-helper.desktop in /etc/xdg/autostart so that it’s started on each session automatically:

[Desktop Entry]
Type=Application
Name=MATE Settings Daemon Background Helper
Comment=Sets the user background in AccountsService on MATE
Exec=/usr/bin/msd-background-helper
OnlyShowIn=MATE;
X-MATE-Autostart-enabled=true

I’ll try to make a proper deb package for easier distribution and installation.

Note that the default Ubuntu Mate LightDM GTK greeter disables the user background option, so you’ll have to activate it through the LightDM GTK+ Greeter Settings that’s in System → Administration (“use user wallpaper if available”).

1 Like

@Wimpy: do you think this could/should be added directly in Ubuntu MATE?

I’m thinking about it. The script needs cleaning up a little, might be better to run it periodically than perpetually.

If I’m not mistaken, the content of the loop triggers only when dbus-monitor sends a signal when the background is changed.

Yeah, but there is a perpetual bash process running to provide it.

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?