Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-07-29 18:36:27

Aldebaraan
Member
Registered: 2020-07-22
Posts: 6

Open current wallpaper

Is there a way to open the current wallpaper that the xfdesktop chose randomly? Or at least get the path to the file?

Offline

#2 2020-07-29 21:01:23

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 252

Re: Open current wallpaper

Most are in /usr/share/backgrounds or /usr/share/wallpapers.


Siduction
Debian Sid
Xfce 4.14

Offline

#3 2020-07-29 22:43:41

Misko_2083
Member
Registered: 2015-10-13
Posts: 146
Website

Re: Open current wallpaper

Run this in terminal

xfconf-query -c xfce4-desktop -m

...and then change the background using the Settings Manager > Desktop.

The command monitors channel xfce4-desktop for changes.
It will tell which property on channel xfce4-desktop is changed.

Then you can check that property to list the current background

xfconf-query -c xfce4-desktop -p insert_property_here

Now opening with ristretto

ristretto "$(xfconf-query -c xfce4-desktop -p insert_property_here)"

Offline

#4 2020-07-30 02:45:36

Aldebaraan
Member
Registered: 2020-07-22
Posts: 6

Re: Open current wallpaper

Found a better solution. The code above doesn't open the original file. I have a lot of wallpapers that i downloaded in bulk from the internet but didn't have the time to handpick them so i delete the ones that i don't like as they come. So i needed a option that opened the original file so i could delete or make copies of what i liked. I managed to make it work by using Thunar's custom actions:

Open Wallpaper
Command: bash ~/.config/openbox/wallchange/open-wallpaper.sh

Next Wallpaper
Command: bash ~/.config/openbox/wallchange/wallchange-xfce.sh


wallchange-xfce.sh

#!/bin/bash
WPCURRENT="$(find ~/Pictures/Wallpapers/ -type f |shuf -n1)" #gets a random image

echo -n ${WPCURRENT} > ~/.config/openbox/wallchange/wallpaper-history.txt #prints chosen image to txt file

xfconf-query --channel xfce4-desktop --property  /backdrop/screen0/monitorVGA1/workspace0/last-image --set $WPCURRENT #sets the wallpaper

cat ~/.config/openbox/wallchange/wallpaper-history.txt  #prints it to console

open-wallpaper.sh

#!/bin/sh
IMG=$(cat ~/.config/openbox/wallchange/wallpaper-history.txt | awk -F "'|/" '{print $0}')
xviewer "${IMG}" &
exit

Problem is that sometimes i get a blank screen even if the output points to a image. Any idea why this happens?

Offline

#5 2020-07-30 20:52:43

Aldebaraan
Member
Registered: 2020-07-22
Posts: 6

Re: Open current wallpaper

Nevermind. $WPCURRENT needs to be "$WPCURRENT" otherwise images that have spaces on their name cause the issue.

Offline

Board footer

Powered by FluxBB