Files
2026-06-25 16:15:58 +07:00

12 lines
463 B
Bash
Executable File

#!/bin/bash
wall_dir="${1:?wallpaper directory required}"
img=$(find "$wall_dir" -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