Skip to content

Instantly share code, notes, and snippets.

@rgson
Last active March 10, 2019 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgson/6dca5e1cf3a9738d1eae936bedb04bea to your computer and use it in GitHub Desktop.
Save rgson/6dca5e1cf3a9738d1eae936bedb04bea to your computer and use it in GitHub Desktop.
Lorem Picsum Wallpapers (Cinnamon)
#!/bin/sh
set -e
# Sets your wallpaper to a random photo from <https://picsum.photos>.
# Run regularly (e.g. automatically on login) to keep your desktop fresh.
cache="${XDG_CACHE_HOME:-$HOME/.cache}/picsum-wallpapers"
mkdir -p "$cache"
new="$cache/new.jpg"
use="$cache/current.jpg"
resolution=$(xrandr | grep -F '*' | awk '{print $1}' | sort -nr | head -n1)
curl -sL "https://picsum.photos/$(echo "$resolution" | tr x /)?random" >"$new"
if [ $? -ne 0 ]; then
echo 'Error downloading wallpaper' >&2
exit 1
fi
mv "$new" "$use"
gsettings set org.cinnamon.desktop.background picture-uri "file://$use"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment