Last active
March 10, 2019 22:30
-
-
Save rgson/6dca5e1cf3a9738d1eae936bedb04bea to your computer and use it in GitHub Desktop.
Lorem Picsum Wallpapers (Cinnamon)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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