[download]

local/bin/lock

   1 #!/bin/bash
   2 
   3 f=~/.cache/lock.png
   4 b=~/.theme/background.jpg
   5 r=$(xrandr | awk '/\*/ { print $1 }')
   6 
   7 [[ $(date -r $b +%s) > $(date -r $f +%s) ]] && convert $b -resize "$r!" \
   8 \( -size 39x39 xc:none -size 2x2 xc:#fff6 -composite -write mpr:i +delete \)  \
   9 \( +clone -alpha transparent -tile mpr:i -draw 'color 0,0 reset' \) \
  10 -geometry +3+9 -composite -colorspace gray $f
  11 
  12 amixer -q set Master mute
  13 i3lock -ni $f
  14 amixer -q set Master unmute