~scriptsdisplay
10 itemsDownload ./*

10 itemsDownload ./*

..
ana-wall-login.sh
ana-wall-next.sh
ana-wall-refresh.sh
ana-wall.sh
brightness.sh
brightness_change
keep-on.sh
screen-dim
screenshot.sh
xorient.sh


displayana-wall.sh
59•  2 months ago•  DownloadRawClose
2 months ago•  59

{}
#!/bin/bash
#
# Author: twily                 2023
# Website: twily.info
# Description: Set wallpaper in kde on interval--default get random selfie download from analiestar.com
# Usage: $ ./ana-wall.sh 0.5 # 30 sec
#

export DISPLAY=:0

min=10
if [ ! -z "$1" ]; then
    min=$1
fi
#sec=$(echo "$min*60" | bc -l)
sec=$(( $min*60 ))

# set youe home folder/picture store location
picdir="/home/amalie/Pictures/selfies"

# files for ana-wall, ana-wall-next and refresh need access too
logdir="/home/amalie"

# to change sddm set this folder (or which theme you use) to chmod 777
sddmpath="/usr/share/sddm/themes/breeze"

theme='[General]
background=ana-wall.jpg
type=image'
echo "$theme" > "$sddmpath"/theme.conf.user # chmod 777 this file also or pre-set text above

TS=0
if [ ! -f $logdir/ana-wall-lock.log ]; then
    echo $TS > $logdir/ana-wall-lock.log
else
    if [ -s $logdir/ana-wall-lock.log ]; then
        echo $(cat $logdir/ana-wall-lock.log)
    else
        echo $TS > $logdir/ana-wall-lock.log
    fi
fi

while :; do
    RTS=$(cat $logdir/ana-wall-lock.log)
    TS=$(date +%s)
    if [ $RTS -le $TS ]; then
        # write 0 to log file for instant change etc
        NTS=$(( $TS+$sec ))
        echo $NTS > $logdir/ana-wall-lock.log


        # fetch blob image -- change id/name to analiestar.com member page details
        curl "https://analiestar.com/randomselfie.php?name=username&id=XXXXX-XXXXX-XXXXX-XXXXX" -o ~/ana-wall-temp.jpg
        name=$( cat ~/ana-wall-temp.jpg | md5sum | cut -d' ' -f1 )
        
        echo "Downloading new image from analiestar.com--md5=$name(.jpg)"
        
        exists=0
        for f in "$picdir"; do
            if [ "$f" == "$name.jpg" ]; then
                echo "Exists..skipping save"
                exists=1
                break;
            fi
        done
        if [ $exists -eq 0 ]; then
            mv ~/ana-wall-temp.jpg "$picdir/$name.jpg"
        else
            rm ~/ana-wall-temp.jpg
        fi

        if [ -f "$picdir/$name.jpg" ]; then
            echo -n "$picdir/$name.jpg" > $logdir/ana-wall-current.log
        fi
 

        # awesome set wallpaper
        #feh -zxFY --bg-fill -D 5 --auto-zoom "$picdir/$name.jpg"
        #nohup feh --bg-fill "$picdir/$name.jpg" > /dev/null 2>&1 &
        runuser -u amalie -- feh --bg-fill "$picdir/$name.jpg" &


        # kde set wallpaper 
        #dbus-send --session --dest=org.kde.plasmashell --type=method_call /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:
        #var Desktops=desktops();
        #for(i=0;i<Desktops.length;i++) {
        #    d=Desktops[i];
        #    d.wallpaperPlugin="org.kde.image";
        #    d.currentConfigGroup=Array("Wallpaper",
        #        "org.kde.image",
        #        "General");
        #    d.writeConfig("Image","file://'$picdir'/'$name'.jpg");
        #}'

        ## kde set lockscreen 
        #if [ -f ~/.config/kscreenlockerrc ]; then
        #    SAVEIFS=$IFS
        #    IFS=$'\n'
        #    readarray -t a < ~/.config/kscreenlockerrc
        #    IFS=$SAVEIFS
        #    ndat=""
        #    changed=0
        #    for((i=0;i<${#a[@]};i++)); do
        #        if [[ ${a[$i]} == Image=* ]]; then
        #            ndat="$ndat""Image=$picdir/$name.jpg\n"
        #            changed=1
        #        else
        #            ndat="$ndat""${a[$i]}\n"
        #        fi
        #    done
        #    if [ $changed -eq 1 ]; then
        #        if [ "$ndat" != "" ]; then
        #            echo -ne "$ndat" > ~/.config/kscreenlockerrc
        #        fi
        #    fi
        #fi

    
        cp -f "$picdir/$name.jpg" "$sddmpath/ana-wall.jpg" # need root access for sddm (optional)
     
        echo ""
    else
        TLEFT=$(( $TS-$RTS ))
    fi

    echo "waiting $TLEFT.."

    sleep 1
done


Top
©twily.info 2013 - 2024
twily at twily dot info



2 131 279 visits
... ^ v