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.
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
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.
xfconf-query -c xfce4-desktop -p /backdrop/screen0/$(xrandr|awk '/\<connected/{print "monitor"$1}')/workspace0/last-image
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.
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
xfconf-query -c xfce4-desktop -l | grep last-image | xargs -n1 -- xfconf-query -c xfce4-desktop -p
Commented
Dec 5, 2020 at 11:06
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 🤣
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).