i3lock.sh 1.1 KB

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