various scripts for various tasks.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

65 lines
2.0 KiB

#!/bin/bash
#export DISPLAY=:0.0
echo "DISPLAY:$DISPLAY"
Dir="~/img/wallpap/1920x1200/"
wallpaplist="~/.wallpaplist"
contact="n@tourmentine.com"
if [ ! -d "$Dir" ];
then
echo "${Dir} does not exist"
exit 1
fi
if [ ! -f ${wallpaplist} ];
then
touch ${wallpaplist}
fi
while true; do
AvailableFiles=`ls -1 ${Dir} | wc -l`
AlreadyViewedFiles=`cat ${wallpaplist} | wc -l`
TotalFiles=`expr $AvailableFiles - $AlreadyViewedFiles`
if [ $TotalFiles -lt 1 ];
then
echo "*** Seems we have displayed all available wallpapers; let's do the time warp...again. ***"
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
RandomNumber=$(( $RANDOM % $TotalFiles ))
test ! $RandomNumber = 0 || RandomNumber=1
RandomFile="$( ls -1 ${Dir} | grep -w -v -F -f ${wallpaplist} | head -n $RandomNumber | tail -n 1)"
if [[ ${RandomFile} == "" ]];
then
echo "*** Oops, something went wrong. erasing cache for security ***"
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 ${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}"
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