Linux Mint uses LightDM GTK greeter for the login screen. It tries to show each user’s wallpaper, and it works well if you stick to the default Cinnamon desktop environment.

However, I use a standalone window manager (dwm) and my wallpaper is set by Nitrogen. This breaks the feature, unless we take some steps.

Solution

At least on Mint (and probably other Debian-based distros), the GTK greeter gets the current user wallpaper from AccountsService. You can find the values set for your user under /var/lib/AccountsService/users/$USER, but, being a D-Bus service, it is better to interface with it through that mechanism.

To set the LightDM background to $bg_path, we can run:

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

We want this to run whenever we change the wallpaper, so it gets automatically synced. So, I wrote a wrapper script that calls this command after I exit Nitrogen.

Done. Now my login screen always shows my current dwm wallpaper.

Relevant versions

  • Linux Mint 20.2
  • dbus 1.12.16-2
  • lightDM 1.30.0
  • lightdm-gtk-greeter 2.0.6