5

Does anyone know where the current wallpaper is stored in xfce4?

I am using SLiM and I want to symlink the SLiM background to whatever my current wallpaper is so I don't have to manually change it every time.

5 Answers 5

4

The are 2 possible locations:

For the user check

~/.local/share/xfce4/backdrops/

Globally check the system wide path

/usr/share/xfce4/backdrops

To share a wallpaper between SLiM and your desktop, rename the used theme background, then create a link from your desktop wallpaper file to the default SLiM theme:

mv /usr/share/slim/themes/default/background.jpg{,.bck}
ln -s /path/to/mywallpaper.jpg /usr/share/slim/themes/default/background.jpg
4
  • I've found those, but that's only the directory where XFCE populates the backgrounds list under desktop settings. I want to know where I can find the currently set background so I can create a symlink to that specific file.
    – user66330
    Commented May 21, 2014 at 19:53
  • Have you tried to look also into /usr/share/backgrounds/xfce/? This wallpaper is a personal loaded image or is from the XFCE install?
    – cioby23
    Commented May 21, 2014 at 21:09
  • A personal image. I want a way to change my xfce wallpaper and have SLiM automatically change with it. I used to have the background.png in my SLiM theme symlinked to ~/.background.png before I started using xfce. I would like to acheive the same result.
    – user66330
    Commented May 21, 2014 at 21:21
  • Well in that case if you know the image name you can search for it and them follow the procedure in the updated aswer.
    – cioby23
    Commented May 21, 2014 at 21:26
1

Although this is an old question as a recent convert to arch and xfce4 I have also been puzzling over this issue. I finally found a solution and thought I'd post it here in case it's of use to others. e.g.

#!/bin/bash -
#
# define xfce4 xml file that holds info about desktops 
# 
DESKTOP="/home/$(id -un)/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml"
#
# define xpath that will extract current desktop background file name
# (NB I am no expert in xpaths and there is probably a much more elegant way
#  to do this but this works for me)
#
XPATH='(//property[@name="workspace0"]/property[@name="last-image"])[last()]/@value'
#
# use xmllint utility to apply xpath to file and extract file path and name
#
IMAGE=$(xmllint --xpath "string(${XPATH})" "${DESKTOP}")
#
# display the file info extracted
#
echo Current Wallpaper File = ${IMAGE}
#
# rest of script........
#

xmllint is provided by the libxml2 package.

1
  • 2
    actually, for multiple monitor config, xfconf-query -c xfce4-desktop -p /backdrop/screen0/$(xrandr|awk '/\<connected/{print "monitor"$1}')/workspace0/last-image
    – eMPee584
    Commented Feb 2, 2018 at 20:37
1

I know this is an old question, but recently I tried figuring this myself. This is my solution:

Create a file named screenLocker inside /usr/bin/

Put the following inside (replace YOUR_CURRENT_THEME with your theme):

#!/bin/bash
ln -fs $(xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image) \ 
/usr/share/slim/themes/YOUR_CURRENT_THEME/background.png && slimlock

then:

sudo chmod +x /usr/bin/screenLocker

and add/edit keyboard shortcut to use command /usr/bin/screenLocker

Now every time you change desktop wallpaper your lock screen will match.

1

This will list all the backgrounds

xfconf-query -c xfce4-desktop -l | grep last-image

then use the above output to get the path of the wallpaper.

for eg:

xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitorVNC-0/workspace0/last-image
1
  • 1
    Combined into a single command: xfconf-query -c xfce4-desktop -l | grep last-image | xargs -n1 -- xfconf-query -c xfce4-desktop -p Commented Dec 5, 2020 at 11:06
-1
xfconf-query -c xfce4-desktop -p /backdrop/screen0/$(xrandr|awk '/\<connected/{print "monitor"$1}')/workspace0/last-image

This will fetch the connected monitor name from xrandr, then get the wallpaper setting for it.

What a waste of time finding this out 🤣

1
  • Doesn't work for me: my monitor is DVI-I-1, but the background is stored under /backdrop/screen0/monitorDVI-0/workspace0/last-image (I think; the entry for /backdrop/screen0/monitor0/workspace0/last-image appears to be stale).
    – Mark
    Commented Feb 2, 2018 at 23:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .