From 54931a6e4f6985d73c624cb657f0507044369ec3 Mon Sep 17 00:00:00 2001 From: n Date: Sun, 21 Jan 2018 23:02:37 +0100 Subject: [PATCH] don't delete wallpaplist + more reporting --- randomwallpaper.sh | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/randomwallpaper.sh b/randomwallpaper.sh index f97ba7c..80d2d99 100755 --- a/randomwallpaper.sh +++ b/randomwallpaper.sh @@ -1,7 +1,11 @@ #!/bin/bash -Dir="/home/n/img/wallpap/1920x1200/" -wallpaplist="/home/n/.wallpaplist" +#export DISPLAY=:0.0 +echo "DISPLAY:$DISPLAY +" +Dir="~/img/wallpap/1920x1200/" +wallpaplist="~/.wallpaplist" +contact="n@tourmentine.com" if [ ! -d "$Dir" ]; then @@ -14,6 +18,7 @@ then touch ${wallpaplist} fi +while true; do AvailableFiles=`ls -1 ${Dir} | wc -l` AlreadyViewedFiles=`cat ${wallpaplist} | wc -l` @@ -22,7 +27,8 @@ TotalFiles=`expr $AvailableFiles - $AlreadyViewedFiles` if [ $TotalFiles -lt 1 ]; then echo "*** Seems we have displayed all available wallpapers; let's do the time warp...again. ***" - rm -f ${wallpaplist} + echo ""> ${wallpaplist} + echo "" | /usr/bin/mail -s "Seems we have displayed all available wallpapers; let's do the time warp...again." ${contact} TotalFiles=$AvailableFiles fi @@ -33,16 +39,27 @@ RandomFile="$( ls -1 ${Dir} | grep -w -v -F -f ${wallpaplist} | head -n $RandomN if [[ ${RandomFile} == "" ]]; then echo "*** Oops, something went wrong. erasing cache for security ***" - rm -f ${wallpaplist} + echo ""> ${wallpaplist} + echo "" | /usr/bin/mail -s "Oops, something went wrong. erasing cache for security" ${contact} exit 1 else echo "${RandomFile}" >> ${wallpaplist} fi +if [ -z "${DBUS_SESSION_BUS_ADDRESS}" ] ; then + . ${HOME}/.dbus/session-bus/`ls -rt ${HOME}/.dbus/session-bus/ | tail -1` + export DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID +fi -#echo "Selected File: $RandomFile" -DISPLAY=:0.0 feh --bg-scale "${Dir%/}/${RandomFile}" -DISPLAY=:0.0 xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${Dir%/}/${RandomFile}" -feh --bg-scale "${Dir%/}/${RandomFile}" +#echo ${DBUS_SESSION_BUS_ADDRESS} + +echo "" | /usr/bin/mail -s "New wallpaper: ${RandomFile}" ${contact} +echo "Selected File: $RandomFile" xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${Dir%/}/${RandomFile}" -pkill gkrellm && DISPLAY=:0.0 gkrellm +xfconf-query -c xfce4-desktop -v -p /backdrop/screen0/monitor0/last-image -s "${Dir%/}/${RandomFile}" +xfconf-query -c xfce4-desktop -v -p /backdrop/screen0/monitorVGA1/workspace0/last-image -s "${Dir%/}/${RandomFile}" +xfconf-query -c xfce4-desktop -v -p /backdrop/screen0/monitor0/workspace0/last-image -s "${Dir%/}/${RandomFile}" +pkill gkrellm && gkrellm & +# 3 hours +sleep 10800 +done