Skip to content

Instantly share code, notes, and snippets.

@jens-ox
Created October 14, 2017 13:49
Show Gist options
  • Save jens-ox/2cec142fccba1658a5ccfa2a3302b952 to your computer and use it in GitHub Desktop.
Save jens-ox/2cec142fccba1658a5ccfa2a3302b952 to your computer and use it in GitHub Desktop.
Script to make blurry lock screen. I previously did this using imagemagick, which was horrifyingly slow, especially on very high resolutions. The ffmpeg approach is way faster 😄
#!/bin/bash
# temporary path for screenshot
TMPBG=/tmp/screen.png
# replace this with your own "lock" icon
LOCK=$HOME/Dropbox/Bilder/Wallpaper/lock.png
# get resolution
RES=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/')
# grab current screen from X framebuffer, blur it and add overlay
ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -i $LOCK -filter_complex "boxblur=10:1,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -vframes 1 $TMPBG -loglevel quiet
# lock i3 with generated image
i3lock -i $TMPBG
# i3lock caches image, can be removed safely
rm $TMPBG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment