i3lock.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env bash
  2. set -ex
  3. ### Regular Splash Screen
  4. #set -eu
  5. #
  6. #[[ -z "$(pgrep i3lock)" ]] || exit
  7. #i3lock -n -u -t -i ${HOME}/.config/i3lock/lock.png
  8. ### Faded lockscreen from https://gist.github.com/csivanich/10914698
  9. # i3lock blurred screen inspired by /u/patopop007 and the blog post
  10. # http://plankenau.com/blog/post-10/gaussianlock
  11. [[ -z "$(pgrep i3lock)" ]] || exit
  12. IMAGE=/tmp/i3lock.png
  13. SCREENSHOTCMD="scrot $IMAGE" # 0.46s
  14. # Alternate screenshot method with imagemagick. NOTE: it is much slower
  15. # SCREENSHOTCMD="import -window root $IMAGE" # 1.35s
  16. # All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
  17. #BLURTYPE="0x5" # 7.52s
  18. ##BLURTYPE="0x2" # 4.39s
  19. #BLURTYPE="5x2" # 3.80s
  20. #BLURTYPE="2x8" # 2.90s
  21. #BLURTYPE="2x3" # 2.92s
  22. # Get the screenshot, add the blur and lock the screen with it
  23. $SCREENSHOTCMD
  24. #convert -channel RGB,Sync -radial-blur 4 $IMAGE $IMAGE
  25. #convert $IMAGE -blur $BLURTYPE $IMAGE
  26. convert -channel RGB,Sync -rotational-blur 2 $IMAGE $IMAGE
  27. composite $HOME/.config/i3/i3lock/lockclip.png $IMAGE -gravity center $IMAGE
  28. i3lock -i $IMAGE
  29. rm $IMAGE