Files
i3-dot/i3/scripts/lock-now
T
2026-06-25 11:33:22 +07:00

11 lines
430 B
Bash
Executable File

#!/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