File with path to desktop background

Is there a file that contains the path to the selected desktop background?

Upon upgrading to Fedora 36, the desktop background was blank/black. I find that really odd, and it’s the first time in many upgrades that this has happened.

I had a custom background set, but the background is not listed in the available background images anymore. I’m trying to find a config file that contains the path to the background file so I can set it again. In the worst case, I have backups from before the upgrade, so I could retrieve the file too, but I would be surprised if it actually got deleted.

The desktop environment is MATE Gnome Shell.

You have to put the backgrounds to a place where the installer has acces to it.

If it is in your home folder it does not have access. So while update it it gets lost.

I know it from my own experience with MATE.

p.s. Downloads folder is also in your home drive :wink:

I think the default location for desktop backgrounds is /usr/share/backgrounds or one of the directories under there. It is possible to select images from your home directory tree as well.

$ ls /usr/share/backgrounds
default.png  default.xml  f32  f33  f34  f36  fedora-workstation  gnome  images

I upgraded directly from f34 to f36 so you do not see the f35 directory there.

1 Like

To be clear, I’m looking for the path to the background that is set, not the default or custom background directories.

My goal is to get the path so I can find where I put my custom background. I think I had put it in the default background directory of /usr/share/backgrounds/ but it’s not there.

@ilikelinux Sorry, I got mixed up. The upgraded computer runs Gnome Shell.

Really? That’s odd; all of my wallpapers are in ~/Pictures/Wallpaper and Xfce hasn’'t the slightest difficulty finding or displaying them.

I have my custom images in /usr/share/backgrounds/images as you can see here.

$ ls /usr/share/backgrounds/images/
default-16_10.png  default-16_9.png  default-5_4.png  default.png  GhostShip.bmp  GhostShip.jpg  psycho.jpg  TuxCamp.jpg

and as you can see in this screenshot they are available for use The top row right, as well as the single one above…

If you click on the “+ Add Picture” there it allows you to select images from your home directory tree.

I am on Workstation, gnome, xorg. Did not check with wayland.

Gnome shell puts user wallpapers here after you select them appearance → add picture: ~/.local/share/backgrounds

You could also just do something like: gsettings list-recursively | grep -i background to see what’s set.

That would be Useful Information if I used Gnome, which I don’t. In Xfce, which I do use, all I have to do is point the Background tab in Desktop Settings to the folder I want to use and everything in it becomes a potential desktop, and if I want to add another, I just copy it to that folder. Different strokes for different folks.

Maybe I’m not being clear enough, but that’s not what I’m asking. I want to know if there is a (config) file that stores the path to the currently set background file.

I will then navigate to that path in my backups to find my desktop background. Also, it gives me a way to see what background is currently set, not through a gui but in a config file.

So, does anyone know where the current background’s path is stored? Without having to run the OS or a specific desktop background settings control panel for a given desktop environment.

Gnome saves such info in dconf:

To list a directory path:
dconf list /org/gnome/desktop/background/

This objects you can read:

color-shading-type
picture-options
picture-uri
picture-uri-dark
primary-color
secondary-color

I guess you are looking for this, right?
dconf read /org/gnome/desktop/background/picture-uri

gsettings list-recursively org.gnome.desktop.background
gives you all the values from the directory path ( thx @grumpey ).

How can dconf or gsettings be used on a backup that is not booted?

Is the information that dconf and gsettings access available in plaintext files or is it in some kind of database?

It is a binary database file which is stored in the ~/.config/dconf directory.

2 Likes

Can dconf or gsettings commands work on a user-specified database file instead of the default? i.e. the ~/.config/dconf from a mounted backup of a system instead of the booted one

1 Like

yes,
env -i XDG_CONFIG_HOME=/path/to/backup/.config dconf dump /

Edit, corrected path. Should’ve had more coffee.

2 Likes

That would be great but it’s not working for me, whether on the mounted backup, or even to get a local user’s configs when run as root user.

While exploring the backups manually and comparing to the upgraded system, I found my old background is contained in /usr/share/backgrounds/fedora-workstation/ but the contents have been deleted/overwritten in the upgraded system…

So at least I found my background, but it seems this is not a safe location to put custom backgrounds. It’s odd, this is the first time since at least f30 that an upgrade has wiped out files in that directory.

1 Like
$ rpm -qf /usr/share/backgrounds/fedora-workstation/
file /usr/share/backgrounds/fedora-workstation is not owned by any package

$ sudo dnf repoquery --whatprovides /usr/share/backgrounds/fedora-workstation/
# nothing

$ sudo dnf repoquery --whatprovides /usr/share/backgrounds/fedora-workstation/*
fedora-workstation-backgrounds-0:1.2-2.fc36.noarch
fedora-workstation-backgrounds-0:1.3-1.fc36.noarch

$ sudo dnf repoquery --whatprovides /usr/share/backgrounds/
desktop-backgrounds-basic-0:36.0.0-2.fc36.noarch
filesystem-0:3.16-2.fc36.x86_64
filesystem-0:3.18-2.fc36.x86_64

So, the folder is not owned by any package, which means even if the fedora-workstation-background package is uninstalled, it’ll remove the files the rpm provides, but leave the directory and any other files you may have put in there (unless one replaced one of the package files):

https://src.fedoraproject.org/rpms/fedora-workstation-backgrounds/blob/rawhide/f/fedora-workstation-backgrounds.spec#_34

Which I guess is OK—usually, all directories must be owned by some package, so this could also be a bug. I filed this to ask the maintainers:

https://bugzilla.redhat.com/show_bug.cgi?id=2128620

I don’t see anything in this package’s commit history suggesting that files not owned by it would be removed/overwritten, but it’s possible another package owned this folder before so it got removed when that was uninstalled. Really hard to figure this out, if it was the case.

I fixed the command, it should’ve been the path to .config vice .config/dconf.

Sorry about that.

1 Like

Was it one of these?
trama-calda.jpg
winter-in-bohemia.png
zen.jpg

Those are removed when upgrading from 1.1-10 to 1.4-1
The commit: Commit - rpms/fedora-workstation-backgrounds - 71aa5af780fae7524d649d08f28c1cb2f3e9d476 - src.fedoraproject.org

Beautiful. That works.

No, it was paisaje.jpg which is also among the lines removed in 0001-Trim-out-unneeded-backgrounds.patch. I wonder why… perfectly nice backgrounds removed.

I thought I had downloaded this image myself long ago but apparently it was one provided by default.

1 Like