Registered Member
|
Hi everyone i wanted to share a script which displays photos in screensaver style. i hate how xscreensaver has parts of the screen in black, especially with portray photos. So i wrote a script which fills the background, blurs the image, and then places the photo in perspective over the top of that. Looks very nice!
The script is configurable, and will install itself when run for the first time. (You will need sudo rights to install its dependencies if you haven't already got them installed. Run the screensaver2.sh file in the DefaultDirPath directory ($HOME"/Scripts/screensaverfiles) after installation.) The screensaver detects full screen and/or web videos or video players playing and has the option to blank screen at a set time. The script should run on any KDE, Unity or LXQt desktops, but should be easily configurable to run on other desktop flavours. [code] #!/usr/bin/bash #run this script to install it in the DefaultDirPath directory. #After installing run screensaver2.sh in the DefaultDirPath directory. #This slideshow aims at filling the screen keeping the images in ratio by blurring the background with the same image. # When an image is displayed it is removed from the photo list. When the photo list runs out a new one will be automatically generated. #Ubuntu based distros with KDE, Unity or LXQt Desktops are supported by default. function has_substring() { [[ "$1" != "${2/$1/}" ]] } #default values re='^[0-9]+$' #check if input is a number idlewaittime=180 #time in seconds to wait before starting to display the images DefaultPicDir=$HOME"/Pictures/" #default image directory DefaultDirPath=$HOME"/Scripts/screensaverfiles" #default running files directory BlurredImagesDir=$DefaultDirPath"/tempphotodir/" #temp directory for background images blur="28x28" #value to blur background image sleeper=28 #time in seconds before next image is shown blankscreen=3600 #3600 seconds is 1 hour before blanking screen. wait=.14 #value to pause between loading the images. (try a greater value if your computer has trouble loading the images at this speed.) KDEpanelupheight=98 #KDE panel height KDEpaneldownheight=0 #value to hide KDE panel. (Try negative value if panel doesn't completely hide with the value on zero') speak="on" #determine if the speech engine is switched on. shuffle="on" period=1.4 passed=0 righton=0 blank=0 #text to speech function speaking() { speech='? '$speech; #often the speech engine chops the first word of the sentence, putting an question mark in front of the sentence prevents this from happening. eval 'pico2wave -l en-GB -w $HOME"/speaking.wav" "${speech}" &';sleep .21;#converting sentence to speech eval 'aplay -f dat $HOME"/speaking.wav" &';speech="";sleep .21;#playing speech file if [ -s $HOME"/speaking.wav" ];then rm $HOME"/speaking.wav";fi #deleting old speech file } #dependecies # These are the essential apps needed to run this photoslide screensaver. The libttspico0 files are needed for speech only and do not effect the functioning of the screensaver itself. (Note:i use imagemagick-6.q16 to manipulated the images but imagemagick will do the job just as well.) if ! [ -s "/bin/xdotool" ] || ! [ -s "/bin/feh" ] || ! [ -s "/bin/wmctrl" ] || ! [ -s "/bin/exiftool" ] || ! [ -s "/usr/lib/mime/packages/imagemagick-6.q16" ] || ! [ -s "/bin/zenity" ] || ! [ "/usr/share/doc/libttspico0" ] || ! [ "/usr/share/doc/python-is-python3" ];then go=1;else go=0;fi;if [ $go = 1 ];then speech='Need to install some dependecies';if [ $speak = "on" ];then speaking;fi;sleep 3;sudo apt-get install wmctrl xdotool feh libimage-exiftool-perl imagemagick-6.q16 zenity;python-is-python3;libttspico0 libttspico-utils libttspico-data;fi #checking running directories. Creating them if they don't exist and copying screensaver.sh in it as screensaver2.sh if ! [ -s $DefaultDirPath"/tempphotodir" ];then speech='Do you want to install the screensaver';if [ $speak = "on" ];then speaking;fi;answer=`zenity --forms --width=700 --title="Installing The Screensaver" --text="The default directories will be made" --separator="," --text=" The default directory is:"$DefaultDirPath" " --separator="," --add-entry="Please Answer (y)es or (n)o" `;if [ $answer = 'n' ] || [ $answer = 'N' ] || [ ${#answer} -lt 1 ];then speech='canceling the installation';if [ $speak = "on" ];then speaking;fi;sleep 4;exit;elif [ $answer = 'y' ] || [ $answer = 'Y' ];then speech='Adding the new installation directories!';if [ $speak = "on" ];then speaking;fi;sleep 2;fi;if ! [ -s $HOME"/Scripts" ];then mkdir $HOME"/Scripts";fi;if ! [ -s $HOME"/Scripts/screensaverfiles" ];then mkdir $HOME"/Scripts/screensaverfiles";fi;mkdir $HOME"/Scripts/screensaverfiles/tempphotodir";cp "./screensaver.sh" $DefaultDirPath"/screensaver2.sh";chmod a+x $DefaultDirPath"/screensaver2.sh";fi; #loading image files into an array - creating photo list from the DefaultPicDir loadfiles() { speech='Preparing your photo list. This may take some time depending on the size of your photo collection.';if [ $speak = "on" ];then speaking;fi;sleep 3;unset array;if [ -s $DefaultDirPath"/orderedphotos.txt" ];then rm $DefaultDirPath"/orderedphotos.txt";rm $DefaultDirPath"/oldphotos.txt";rm $DefaultDirPath"/photolist.txt";fi;printf "%s\n" "$blank" > $DefaultDirPath"/oldphotos.txt";check=`find "$DefaultPicDir" -type f -exec echo {} \;`;xxxx=0;while IFS='F' read -ra ADDR;do for photoname in "${ADDR[@]}";do photo=${photoname: -4};if [ "${photo^^}" = ".JPG" ] || [ "${photo^^}" = '.PNG' ];then xxxx=$(( xxxx + 1 ));array[${#array[*]}]="$photoname";echo $xxxx")"$photoname;fi;done;done <<< "$check";if [ ${#check} -lt 1 ];then speech='there are no images in this directory. Please choose picture default directory with images';if [ $speak = "on" ];then speaking;fi;rm -rf $DefaultDirPath;sleep 7;exit;else speech='there are '$xxxx' images in your photo list.';if [ $speak = "on" ];then speaking;fi;sleep 4;printf "%s\n" "${array[@]}" > $DefaultDirPath"/orderedphotos.txt";printf "%s\n" "${array[@]}" > $DefaultDirPath"/photolist.txt";fi;setupfiles=0;xxxx=0; };if ! [ -s $DefaultDirPath"/photolist.txt" ];then speech="Are your photos in this directory?";if [ $speak = "on" ];then speaking;fi;answer=`zenity --forms --width=700 --title=" Making a photo list of your pictures." --text="Your images are in this directory? "$DefaultPicDir --separator="," --add-entry="Please Answer (y)es or (n)o" `;if [ $answer = 'n' ] || [ $answer = 'N' ] || [ ${#answer} -lt 1 ];then speech='canceling any further installation';if [ $speak = "on" ];then speaking;fi;sleep 4;exit;elif [ $answer = 'y' ] || [ $answer = 'Y' ];then speech='Making New Photolist.';if [ $speak = "on" ];then speaking;fi;sleep 2;fi;loadfiles;fi if ! [ $PWD = $DefaultDirPath ] && [ -s $DefaultDirPath"/tempphotodir" ];then speech='Please run the Screensaver 2 file directly from your default directory';if [ $speak = "on" ];then speaking;fi;echo "";echo "Please run the Screensaver2.sh file directly in the "$DefaultDirPath" folder";sleep 2;else righton=1;fi #loading photolist. readarray -t array < $DefaultDirPath"/photolist.txt"; #Randomly shuffling the photolist shuffle() { speech='now shuffling your photos into a random order.';if [ $speak = "on" ];then speaking;fi;echo 'in shuffle';local i tmp RANGE rand rand2;RANGE=$(( ${#array[*]} - 1 ));if [ $RANGE = -1 ];then readarray -t array < $DefaultDirPath"/photolist.txt";RANGE=$(( ${#array[*]} - 1 ));fi;echo 'shuffling '$RANGE' images';if [ $RANGE -lt 3 ];then loadfiles;readarray -t array < $DefaultDirPath"/photolist.txt";RANGE=$(( ${#array[*]} - 1 ));fi;size=$(( RANGE + 1 ));i2=0;for ((i=size-1; i>0; i--)); do while :;do rand=$((0 + RANDOM % $RANGE));rand2=$((0 + RANDOM % $RANGE));if ! [ $rand = $rand2 ];then break;else echo 'Bypassed identical shuffle move';i2=$(( i2 + 1 ));sleep 2;fi;done;tmp=${array[i]} array[i]=${array[rand]} array[rand]=$tmp;tmp=${array[i2]} array[i2]=${array[rand2]} array[rand2]=$tmp;i2=$(( i2 + 1 ));echo "shuffling entry "$i" to entry "$rand;echo "shuffling entry "$i2" to entry "$rand2;done;printf "%s\n" "${array[@]}" > $DefaultDirPath"/photolist.txt";echo $((RANGE+1))" Photos in the file list ("$DefaultDirPath"/photolist.txt)."; }; #get the idenity number of mouse and keyboard inputdevices() { KeyboardId=`xinput --list --long | grep XIKeyClass | head -n 1 | egrep -o '[0-9]+'`;MouseId=`xinput --list --long | grep XIButtonClass | head -n 1 | egrep -o '[0-9]+'`;echo $KeyboardId"=Keyboard Id < inputdevices2 > Mouse Id="$MouseId; };inputdevices #Getting screen width and screen height. ScreenWidth=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1);echo "Screen Width="$ScreenWidth ScreenHeight=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2);len=${#ScreenHeight};if [ ${ScreenHeight:$((len-1)):1} = "i" ];then ScreenHeight=${ScreenHeight:0:$((len-1))};fi;echo "Screen Height="$ScreenHeight; #Finding your desktop version and linux distro OSversion() { lowercase() { echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" };OS=`lowercase \`uname\``;KERNEL=`uname -r`;MACH=`uname -m`;if [ -f /etc/redhat-release ];then DistroBasedOn='RedHat';DIST=`cat /etc/redhat-release |sed s/\ release.*//`;PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`;REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`;elif [ -f /etc/SuSE-release ] ; then DistroBasedOn='SuSe';PSUEDONAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`;REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`;elif [ -f /etc/mandrake-release ];then DistroBasedOn='Mandrake';PSUEDONAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`;REV=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`;elif [ -f /etc/debian_version ];then DistroBasedOn='Debian';DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`;PSUEDONAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`;REV=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`;fi;if [ -f /etc/UnitedLinux-release ];then DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]";fi;OS=`lowercase $OS`;DistroBasedOn=`lowercase $DistroBasedOn`;readonly OS;readonly DIST;readonly DistroBasedOn;readonly PSUEDONAME;readonly REV;readonly KERNEL;readonly MACH;version=$OS" "$DistroBasedOn" "$DIST" "$PSUEDONAME" "$KERNEL" "$MACH;desktop=`printf "$XDG_CURRENT_DESKTOP" "$GDMSESSION"` } OSversion;echo "Linux Version="$version;echo "Distro Name="$PSUEDONAME;echo 'Desktop='$desktop;if [ $righton = 0 ];then answer=`zenity --forms --width=700 --title=" Do you want to run the screensaver from here?" --text="Do you want to run the screensaver?" --separator="," --add-entry="Please Answer (y)es or (n)o" `;if [ $answer = 'n' ] || [ $answer = 'N' ] || [ ${#answer} -lt 1 ];then speech='Canceling! Load your screensaver from the default Directory';if [ $speak = "on" ];then speaking;fi;sleep 5;exit;elif [ $answer = 'y' ] || [ $answer = 'Y' ];then speech='Loading screensaver';if [ $speak = "on" ];then speaking;fi;sleep 3;cd $DefaultDirPath;eval '$DefaultDirPath"/screensaver2.sh" &';sleep 28;exit;fi;fi startscreensaver=`date +%s`;speech="The Screensaver is up and running!";if [ $speak = "on" ];then speaking;fi;sleep 4 #panel up on KDE Desktop KDEpanelup() { qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height =$KDEpanelupheight" } #panel down on KDE KDEpaneldown() { qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height =$KDEpaneldownheight" } #dock hide on Unity UbuntuHidePanel() { gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false } #dock show on Unity UbuntuShowPanel() { gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true } #Lubuntu with the LXQt desktop. Created an image file of 1x1 pixel size and placed it in the DefaulDirPath as pixel.jpg. (Searching for a random image file in $HOME"/.config, and then converting it to an 1x1 image file, placing it in as DefaulDirPath"/pixel.jpg"). Don't forget to put your panel/dock on auto-hide when a window overlaps. (right click on panel. Choose panel settings. Tick auto-hide when a window overlaps the panel from menu.) LubuntuHidePanel() { if ! [ -s $DefaultDirPath"/pixel.jpg" ];then unset array;readarray -t array < $DefaultDirPath"/photolist.txt";getimage=${array[1]};unset array;convert -resize 1x1 -background black $getimage $DefaultDirPath"/pixel.jpg";fi;if [ $passed = 1 ];then pixelpid=`xdotool search --class pixel`;if [ ${pixelpid:-null} = null ];then add=0;eval 'feh -x --geometry 1x1+0+$((ScreenHeight-7)) --class "pixel" $DefaultDirPath"/pixel.jpg" & pixelpid=$!';fi;fi };LubuntuHidePanel;passed=1 #screensaver main control function screensaver() { sleeperbak=$sleeper;echo "entering screensaver";readarray -t array < $DefaultDirPath"/photolist.txt";eval $(xdotool getmouselocation --shell);mxx=$X;myy=$Y;readarray -t oldphotos < $DefaultDirPath"/oldphotos.txt";pidbak1=0;pidbak2=0;pass=1;if [ $desktop = "KDE" ];then KDEpaneldown;elif [ $desktop = "Unity" ];then UbuntuHidePanel;elif [ $desktop = "LXQt" ];then LubuntuHidePanel;fi;while :;do screensaver1;for R in `seq 1 $sleeper`;do eval $(xdotool getmouselocation --shell);STATE1=$(xinput --query-state $KeyboardId );endscreensaver=`date +%s`;if [ $((endscreensaver-startscreensaver)) -gt $blankscreen ] && [ $blank = 0 ];then sleeper=49490;period=7;blank=1;xset dpms force off;elif [[ "$STATE1" == *"key[9]=down"* ]];then break 2;fi;if [ $X -lt $(( mxx - 77 )) ] || [ $X -gt $(( mxx + 77 )) ] || [ $Y -lt $(( myy - 77 )) ] || [ $Y -gt $(( myy + 77 )) ];then if [ $pid1 ]; then kill -9 $pid1;kill -9 $pid2;fi;break 2;else sleep $period;fi;done;done;if [ $desktop = "KDE" ];then KDEpanelup;elif [ $desktop = "Unity" ];then UbuntuShowPanel;elif [ $desktop = "LXQt" ];then kill -9 $pixelpid;fi;if [ -s $photoname2 ];then rm $photoname2;fi;printf "%s\n" "${oldphotos[@]}" > $DefaultDirPath"/oldphotos.txt";printf "%s\n" "${array[@]}" > $DefaultDirPath"/photolist.txt";unset oldphotos;unset array;blank=0;xset dpms force on;sleeper=$sleeperbak;period=1.4 } #manipulating the image to make ready for displaying. Background image will be blurred and foreground image placed in perspective screensaver1() { resized=$ScreenWidth"x"$ScreenHeight"!";echo 'entering screensaver1';loadphoto;if [ $width -gt $height ] && [ $rotate = 1 ];then width3=$width;height3=$height;width=$height3;height=$width3;fi;answer=`printf "%.*f\n" '1' $(python -c "print($width / $height)")`;if [ $width = $ScreenWidth ] && [ $height = $ScreenHeight ];then first='0) fit '$ScreenWidth"x"$ScreenHeight;width2=$ScreenWidth;height2=$ScreenHeight;elif [ $answer = 2.2 ] || [ $answer = 2.1 ] || [ $answer = 2.0 ] || [ $answer = 2.3 ] || [ $answer = 2.4 ];then height2=$height;width2=$width;else if [ $height -lt $ScreenHeight ] && [ $rotate = 0 ];then first='1) -lt ScreenHeight '$ScreenHeight;token=`printf "%.*f\n" '4' $(python -c "print($ScreenHeight / $height".00")")`;height2=`printf "%.*f\n" '0' $(python -c "print($height * $token)")`; width2=`printf "%.*f\n" '0' $(python -c "print($width * $token)")`;elif [ $height -gt $ScreenHeight ] && [ $rotate = 0 ];then first='2) -gt ScreenHeight '$ScreenHeight;token=`printf "%.*f\n" '4' $(python -c "print($height".00" / $ScreenHeight)")`;height2=`printf "%.*f\n" '0' $(python -c "print($height / $token)")`; width2=`printf "%.*f\n" '0' $(python -c "print($width / $token)")`;elif [ $height -gt $ScreenHeight ] && [ $rotate = 1 ];then first='3) -gt '$ScreenHeight' & rotate=1';token=`printf "%.*f\n" '4' $(python -c "print($height".00" / $ScreenHeight)")`;height2=`printf "%.*f\n" '0' $(python -c "print($height / $token)")`; width2=`printf "%.*f\n" '0' $(python -c "print($width / $token)")`;elif [ $rotate = 1 ] && [ $height -lt $ScreenHeight ];then first='4) -lt ScreenHeight '$ScreenHeight' & rotate=1';token=`printf "%.*f\n" '4' $(python -c "print($ScreenHeight".00" / $height)")`;height2=`printf "%.*f\n" '0' $(python -c "print($height * $token)")`;width2=`printf "%.*f\n" '0' $(python -c "print($width * $token)")`;fi;fi;photoname2=$(basename $photoname);convert -resize $resized $photoname $BlurredImagesDir$photoname2;mogrify-im6.q16 -blur $blur $BlurredImagesDir$photoname2;photoname2=$BlurredImagesDir$photoname2;width3=$((ScreenWidth-width2));width4=$((width3/2));if [ $width -lt $ScreenWidth ] && [ $height -lt $ScreenHeight ] && [ $rotate = 0 ];then eval 'feh -x --auto-rotate --hide-pointer --geometry $ScreenWidth"x"$ScreenHeight+0+0 $photoname2 &';pid1=$!;sleep .1;eval 'feh -x --auto-rotate --zoom fill --geometry $width2"x"$ScreenHeight+$width4+0 -B black $photoname &';pid2=$!;elif [ $rotate = 0 ] && [ $height -gt $ScreenHeight ];then eval 'feh -x --auto-rotate --hide-pointer --geometry $ScreenWidth"x"$ScreenHeight+0+0 $photoname2 &';pid1=$!;sleep $wait;eval 'feh -x --auto-rotate -. --hide-pointer --geometry $width2"x"$ScreenHeight+$width4+0 -B Black $photoname &';pid2=$!;elif [ $height -gt $ScreenHeight ] && [ $rotate = 1 ];then eval 'feh -x --zoom fill --auto-rotate --geometry $ScreenWidth"x"$ScreenHeight+0+0 --hide-pointer $photoname2 &';pid1=$!;sleep $wait;eval 'feh -x -. --hide-pointer --geometry $width2"x"$ScreenHeight+$width4+0 --auto-rotate -B black $photoname &';pid2=$!;elif [ $height -lt $ScreenHeight ] && [ $rotate = 1 ];then eval 'feh -x --zoom fill --auto-rotate --geometry $ScreenWidth"x"$ScreenHeight+0+0 --hide-pointer $photoname2 &';pid1=$!;sleep $wait;eval 'feh -x --zoom fill --hide-pointer --geometry $width2"x"$ScreenHeight+$width4+0 --auto-rotate -B black $photoname &';pid2=$!;fi;if ! [ $pid1 = $pidbak1 ] && [ $pass = 0 ];then echo 'pid1!';kill -9 $pidbak1;fi;if ! [ $pid2 = $pidbak2 ] && [ $pass = 0 ];then echo 'pid2!';kill -9 $pidbak2;fi;sleep $wait;pass=0;pidbak1=$pid1;pidbak2=$pid2;rm $photoname2;echo "width="$width;echo "height="$height;echo "width2="$width2;echo "height2="$height2;echo 'token='$token;echo "rotate="$rotate;echo 'first='$first;echo 'photoname='$photoname;screensaver=0; } #Loading the image loadphoto() { echo 'entering loadphoto';oldphotoNo="${#oldphotos[@]}";arrayNo="${#array[@]}";if [ $arrayNo -lt 1 ];then unset array;photofiles=1;loadfiles;readarray -t array < $DefaultDirPath"/photolist.txt";printf "%s\n"$blank" " > $DefaultDirPath"/oldphotos.txt";readarray -t oldphotos < $DefaultDirPath"/oldphotos.txt";else photofiles=0;fi;arrayNo="${#array[@]}";oldphotoNo="${#oldphotos[@]}";RANGE="${#array[@]}";while :;do number=$RANDOM;let "number %= $RANGE";photoname=${array[$number]};if [ ! -f $photoname ];then unset array[$number];fault=1;else if [[ ! -z $photoname ]];then oldphotos[${#oldphotos[*]}]="$photoname";unset array[$number];break;else unset array[$number];fault=1;fi;fi;sleep .1;done;array=("${array[@]}");oldphotos=("${oldphotos[@]}");loadfile2=0;getresolution;loadfile2=1;sleep .21 } # getting the image resolution and if it is a landscape or portray. getresolution() { rotate=0;SizePhoto1=0;answer=`identify $photoname`;x=0;x1=0;x2=0;while IFS=' ' read -ra ADDR;do for ii in "${ADDR[@]}";do x=$(( x + 1 ));if [ $x = 3 ];then photosize=$ii;if [ ${#photosize} = 9 ];then width=`echo -n $ii | head -c 4`;height=`echo -n $ii | tail -c 4`;elif [ ${#photosize} = 8 ];then height=`echo -n $ii | tail -c 4`;if [[ $height =~ $re ]];then width=`echo -n $ii | head -c 3`;else width=`echo -n $ii | head -c 4`;height=`echo -n $ii | tail -c 3`;fi;elif [ ${#photosize} = 7 ];then width=`echo -n $ii | head -c 3`;height=`echo -n $ii | tail -c 3`;fi;break 2;fi;done;done <<< "$answer";if [ $loadfile2 = 0 ];then answer=`exiftool $photoname`;fi;if [ $height -gt $width ];then rotate=1;fi;if [[ "$answer" = *"Rotate 270 CW"* ]] && ! [ $height -gt $width ] || [[ "$answer" = *"Rotate 90 CW"* ]] && ! [ $height -gt $width ] || [[ $answer = *"Portray"* ]] && ! [ $height -gt $width ];then rotate=1;convert -resize $heightx$width -auto-orient "$photoname" "$photoname";fi; }; function finish() { if [ $desktop = "KDE" ];then KDEpanelup;elif [ $desktop = "Unity" ];then UbuntuShowPanel;elif [ $desktop = "LXQt" ];then kill -9 $pixelpid;fi; } trap finish EXIT #full screen or video playing detection fullscreencheck() { fullscreen=0;WINDOW=$(echo $(xwininfo -id $(xdotool getactivewindow) -stats | \ egrep '(Width|Height):' | \ awk '{print $NF}') | \ sed -e 's/ /x/') SCREEN=$(xdpyinfo | grep -m1 dimensions | awk '{print $2}') if [ "$WINDOW" = "$SCREEN" ]; then fullscreen=1;fi; if wmctrl -l | grep -i "youtube\|vimeo\|vlc\|mplayer\|smplayer\|totem\|kmplayer\|dragonplayer\|" && \ grep RUNNING /proc/asound/card*/pcm*/sub*/status ; then fullscreen=1;fi } #loading photolist. readarray -t array < $DefaultDirPath"/photolist.txt"; #priming final screensaver values if [ $shuffle = "on" ];then shuffle;fi #randomly shuffling your images endscreensaver=`date +%s`;#setting idle time eval $(xdotool getmouselocation --shell);#getting x, y value of the mouse cursor xxx=$X yyy=$Y #running loop while :;do eval $(xdotool getmouselocation --shell); sleep 1 if [ $xxx = $X ] && [ $yyy = $Y ];then endscreensaver=`date +%s`;echo $((endscreensaver-startscreensaver));if [ $((endscreensaver-startscreensaver)) -gt $idlewaittime ];then fullscreencheck;if [ $fullscreen = 0 ];then screensaver;fi;fi;else xxx=$X;yyy=$Y;startscreensaver=`date +%s`;fi done [/code] |
Registered Member
|
Yeah, I can set a screensaver just fine, it's just creating the slideshow that is the problem for me. Thank you for the article!
|
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]