From cbca6906aebe60522bc3f6f28e8abccb7e5396f8 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 11 Mar 2010 00:50:28 +0100 Subject: [PATCH] improve getMadame.sh --- scripts/getMadame.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/getMadame.sh b/scripts/getMadame.sh index 88c2c31..934c7d9 100755 --- a/scripts/getMadame.sh +++ b/scripts/getMadame.sh @@ -34,6 +34,7 @@ function fixdbus { echo Dbus fixed OK } + # please install libnotify-bin to popup notification function notify { if [[ -e /usr/bin/notify-send ]] @@ -42,13 +43,20 @@ function notify { fi } -fileprefix=$HOME/Images/bonjourmadame-wp- +dirprefix=$HOME/Images +fileprefix=$dirprefix/bonjourmadame-wp- todaywp=$fileprefix$(date +%y-%m-%d-%H-%M).jpg while [ $(chkinternet) != "1" ]; do sleep 15; done echo Internet connection OK +if [[ ! -d $dirprefix ]] +then + echo "Creating $dirprefix"; + mkdir $dirprefix; +fi + wget -O - http://www.bonjourmadame.fr | grep -Eo "(http://www.bonjourmadame.fr/photo/[^\"]+)|(http://[0-9]+.media.tumblr.com/tumblr[^\"]+)" | head -n 1 | wget -q -i - -O $todaywp echo Photo downloaded OK @@ -59,6 +67,9 @@ fixdbus if [[ -e /usr/bin/xfconf-query ]] then xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $todaywp +elif [[ -e /usr/bin/feh ]] +then + feh --bg-scale $todaywp elif [[ -e /usr/bin/gconftool-2 ]] then gconftool-2 --type string --set /desktop/gnome/background/picture_filename $todaywp