#!/bin/bash wall_dir="${1:?wallpaper directory required}" img=$(find "$wall_dir" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1) if [ -n "$img" ]; then exec swaylock -i "$img" else exec swaylock fi