Skip to content

Instantly share code, notes, and snippets.

@daniel-j
Last active July 26, 2022 08:07
Show Gist options
  • Save daniel-j/7551939 to your computer and use it in GitHub Desktop.
Save daniel-j/7551939 to your computer and use it in GitHub Desktop.
This is a simple random wallpaper changer to use with Awesome WM. You need to install feh to use this.
#!/bin/bash
#
# Created by djazz // Dangershy
# Dependencies: feh
#
FOLDER="~/Pictures/wallpapers"
DELAY=10
# to make it loop over lines instead of spaces in filenames
IFS=$'\n';
while true; do
LIST=`find "$FOLDER" -type f \( -name '*.jpg' -o -name '*.png' \) | shuf`
for i in $LIST; do
echo "$i"
# gsettings set org.gnome.desktop.background picture-uri "file://$i"
feh "$i" --bg-fill
# pcmanfm -w "$i"
sleep ${DELAY}m
done
sleep 1
done
#!/bin/bash
#
# Created by djazz
# Dependencies: curl
# You need Gnome or feh, depending on what DE/WM you use
#
IMGLIST="http://djazz.se/pony/wallpapers/images.txt"
IMGSCRIPT="http://djazz.se/pony/wallpapers/image.php"
DELAY=10
DOWNLOAD_DIR=/tmp
USE_GNOME=0 # uses /tmp
USE_FEH=1
# to make it loop over lines instead of spaces in filenames
IFS=$'\n';
while true; do
LIST=`curl -s "${IMGLIST}" | shuf`
for i in $LIST; do
echo "$i"
if [ "$USE_GNOME" -eq 1 ]; then
curl -s -G "${IMGSCRIPT}" --data-urlencode "f=$i" -o "$DOWNLOAD_DIR/next-wallpaper"
mv "$DOWNLOAD_DIR/next-wallpaper" "$DOWNLOAD_DIR/wallpaper"
gsettings set org.gnome.desktop.background picture-uri "file://$DOWNLOAD_DIR/wallpaper"
fi
if [ "$USE_FEH" -eq 1 ]; then
curl -s -G "${IMGSCRIPT}" --data-urlencode "f=$i" | feh - --bg-fill &
fi
sleep ${DELAY}m
done
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment