Random picture on swaylock

I was looking for a good source of random wallpapers to use on the lock screen, and it turns out that Unsplash is great.

This should work an any wlroots-based WM:

#!/bin/bash

WP_FILE=$HOME/.config/wallpaper.jpg
wget -q -O $WP_FILE https://source.unsplash.com/1920x1080/?night,ocean,space,nature

if [[ -s "${WP_FILE}" ]]; then
    swaylock --image $WP_FILE
else
    swaylock -f -c 000000
fi
6 Likes