2023-12-16 14:11:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
date='date +%Y-%m-%d\ %T'
|
|
|
|
logfile=~/.wkgen.log
|
2024-05-24 08:48:17 +02:00
|
|
|
prepath="${XDG_PICTURES_DIR:=$HOME/Pictures}"
|
|
|
|
mkdir -p "$prepath/wallpaper"
|
|
|
|
filelocation="$prepath/wallpaper/wk-progress.1.png"
|
2023-12-16 14:11:41 +01:00
|
|
|
set -e
|
2024-05-24 08:48:17 +02:00
|
|
|
oldhash="$(sha256sum $filelocation || echo none)"
|
2023-12-16 14:11:41 +01:00
|
|
|
echo "[$(eval $date)]: starting webrequests..." | tee -a $logfile
|
2024-05-24 08:48:17 +02:00
|
|
|
curl -s -o $filelocation -A "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36" -o "wallpaper.png" "http://wkw.natural20design.com/?k=7b98a684-5c91-44ab-86b1-f7023609fe4e&d=1"
|
|
|
|
newhash="$(sha256sum $filelocation)"
|
|
|
|
echo -e "\tnew:\t$newhash\n\told:\t$oldhash"
|
|
|
|
if [[ "$oldhash" = "$newhash" ]]; then
|
|
|
|
echo "same files, nothing to do"
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
echo "[$(eval $date)]: setting wallpaper..." | tee -a $logfile
|
2024-05-24 08:55:27 +02:00
|
|
|
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://'$filelocation'");
|
|
|
|
}'
|
2024-05-24 08:48:17 +02:00
|
|
|
echo "[$(eval $date)]: done" | tee -a $logfile
|
|
|
|
fi
|