don't delete wallpaplist + more reporting

This commit is contained in:
n 2018-01-21 23:02:37 +01:00
parent 60d3848f1a
commit 54931a6e4f
1 changed files with 26 additions and 9 deletions

View File

@ -1,7 +1,11 @@
#!/bin/bash #!/bin/bash
Dir="/home/n/img/wallpap/1920x1200/" #export DISPLAY=:0.0
wallpaplist="/home/n/.wallpaplist" echo "DISPLAY:$DISPLAY
"
Dir="~/img/wallpap/1920x1200/"
wallpaplist="~/.wallpaplist"
contact="n@tourmentine.com"
if [ ! -d "$Dir" ]; if [ ! -d "$Dir" ];
then then
@ -14,6 +18,7 @@ then
touch ${wallpaplist} touch ${wallpaplist}
fi fi
while true; do
AvailableFiles=`ls -1 ${Dir} | wc -l` AvailableFiles=`ls -1 ${Dir} | wc -l`
AlreadyViewedFiles=`cat ${wallpaplist} | wc -l` AlreadyViewedFiles=`cat ${wallpaplist} | wc -l`
@ -22,7 +27,8 @@ TotalFiles=`expr $AvailableFiles - $AlreadyViewedFiles`
if [ $TotalFiles -lt 1 ]; if [ $TotalFiles -lt 1 ];
then then
echo "*** Seems we have displayed all available wallpapers; let's do the time warp...again. ***" 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 TotalFiles=$AvailableFiles
fi fi
@ -33,16 +39,27 @@ RandomFile="$( ls -1 ${Dir} | grep -w -v -F -f ${wallpaplist} | head -n $RandomN
if [[ ${RandomFile} == "" ]]; if [[ ${RandomFile} == "" ]];
then then
echo "*** Oops, something went wrong. erasing cache for security ***" 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 exit 1
else else
echo "${RandomFile}" >> ${wallpaplist} echo "${RandomFile}" >> ${wallpaplist}
fi 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" #echo ${DBUS_SESSION_BUS_ADDRESS}
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}" echo "" | /usr/bin/mail -s "New wallpaper: ${RandomFile}" ${contact}
feh --bg-scale "${Dir%/}/${RandomFile}" echo "Selected File: $RandomFile"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${Dir%/}/${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