Skip to content

Instantly share code, notes, and snippets.

@lordii
Forked from csivanich/lock.sh
Last active August 29, 2015 14:09
Show Gist options
  • Save lordii/4eb0d1c0c32ab164414b to your computer and use it in GitHub Desktop.
Save lordii/4eb0d1c0c32ab164414b to your computer and use it in GitHub Desktop.
#!/bin/bash
# i3lock blurred screen inspired by /u/patopop007 and the blog post
# http://plankenau.com/blog/post-10/gaussianlock
# Timings are on an Intel i7-2630QM @ 2.00GHz
# Dependencies:
# imagemagick
# i3lock
# scrot (optional but default)
IMAGE=/tmp/i3lock.png
SCREENSHOT="scrot $IMAGE" # 0.46s
# Alternate screenshot method with imagemagick. NOTE: it is much slower
# SCREENSHOT="import -window root $IMAGE" # 1.35s
# Here are some imagemagick blur types
# Uncomment one to use, if you have multiple, the last one will be used
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
#BLURTYPE="0x5" # 7.52s
#BLURTYPE="0x2" # 4.39s
#BLURTYPE="5x2" # 3.80s
BLURTYPE="2x8" # 2.90s
#BLURTYPE="2x3" # 2.92s
# Get the screenshot, add the blur and lock the screen with it
$SCREENSHOT
convert $IMAGE -blur $BLURTYPE $IMAGE
mpc pause
i3lock -n -i $IMAGE
rm $IMAGE
mpc play
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment