#!/bin/bash img=$(find /sync/images/wallpapers/ -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) | shuf -n1) tmp=/tmp/lockscreen.png res=$(xrandr --current | awk '/ connected/ {getline; print $1; exit}') : "${res:=1920x1080}" if [ -n "$img" ] && convert "$img" -resize "${res}^" -gravity Center -extent "$res" "$tmp" 2>/dev/null; then exec i3lock -i "$tmp" --nofork else exec i3lock -c 000000 --nofork fi