Xfce Forum

Sub domains
 

You are not logged in.

#1 2006-08-29 04:00:41

fahrenheit
Member
Registered: 2006-08-29
Posts: 2

How to get the current backdrop path?

Hi all, i have a question: is there someway to get the current backdrop path from the backdrops list?

is it stored in some file or something?

my objective is to make a simple backdrops laucher, the randomizing part is done by xfdesktop -reload, i'm missing the remove current backdrop from list and for that i need to get the current backdrop path, any ideias?

thanks in advance

Offline

#2 2006-08-30 18:50:49

Pindakoe
Member
From: NL
Registered: 2003-11-26
Posts: 116

Re: How to get the current backdrop path?

This is impossible for Xfce 4.0 en 4.2 AFAIK. I do not know whether this changed for 4.4

Offline

#3 2006-08-30 21:57:12

TomE
Member
Registered: 2005-02-05
Posts: 132

Re: How to get the current backdrop path?

xfdesktop can't do this, but bash can.
And I happen to be bored enough to wright the script.  ;D
It read the wallpaper from a file, links it to "~/.config/xfce4/deskimg", removes the wallpaper from the list and reloads xfdesktop.

#!/bin/bash

FILES=`head -n 1 ~/.config/xfce4/deskfiles | awk -F"files=" {'print $2'}`

RAND=$((RANDOM%$FILES+1))

IMGLINE="$(($RAND+1))p"
LINK=`sed -n $IMGLINE ~/.config/xfce4/deskfiles`

rm ~/.config/xfce4/deskimg
link $LINK ~/.config/xfce4/deskimg

FILES_NEW=$(($FILES-1))

sed -i -e "s/files\=$FILES/files\=$FILES_NEW/g" ~/.config/xfce4/deskfiles

DELLINE="$(($RAND+1))d"
sed -i -e $DELLINE ~/.config/xfce4/deskfiles

xfdesktop --reload

You will need to make a file with all your wallpapers in call "~/.config/xfce4/deskfiles" it should look like this

files=3
/path/to/wallpaper1.png
~/path/to/wallpaper2.png
/path/to/wallpaper3.jpg

you can have as many wallpapers as you like just make sure that "file=" has the right number or it will not display all the wallpapers.
xfdesktop will need to be pointed at ~/.config/xfce4/deskimg

Offline

#4 2006-09-01 11:07:35

fahrenheit
Member
Registered: 2006-08-29
Posts: 2

Re: How to get the current backdrop path?

thanks, that is an approach, should have thought of making the bash aproach also smile

again many thanks

Offline

#5 2006-09-03 14:52:36

TomE
Member
Registered: 2005-02-05
Posts: 132

Re: How to get the current backdrop path?

fahrenheit wrote:

thanks, that is an approach, should have thought of making the bash aproach also smile

again many thanks

I've updated it a bit now you can use any backdrop.list made with xfdesktop, but you still need to use ~/.config/xfce4/deskimg as the image file.

#!/bin/bash

#change this to any list made with xfdesktop
LIST=~/.config/xfce4/desktop/backdrops.list

FILES=`grep -c "/" $LIST`

RAND=$((RANDOM%$FILES+1))

IMGLINE="$(($RAND+1))p"
LINK=`sed -n $IMGLINE $LIST`

rm ~/.config/xfce4/deskimg
link $LINK ~/.config/xfce4/deskimg

FILES_NEW=$(($FILES-1))

sed -i -e "s/files\=$FILES/files\=$FILES_NEW/g" $LIST

DELLINE="$(($RAND+1))d"
sed -i -e $DELLINE $LIST

xfdesktop --reload

Offline

Registered users online in this topic: 0, guests: 1
[Bot] CCBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 531.98 KiB (Peak: 532.6 KiB) ]