Skip to content

Instantly share code, notes, and snippets.

@fbrinker
Created February 25, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbrinker/336321b13c41af737254385ea9eb4f8e to your computer and use it in GitHub Desktop.
Save fbrinker/336321b13c41af737254385ea9eb4f8e to your computer and use it in GitHub Desktop.
Create a screenshot, apply some filters (blur, reduce colors and bightness) and add a logo to it. Then use it as lockscreen via i3lock
#!/bin/bash
# Dependencies:
# ffmpeg
# i3lock-color-git
IMAGE=/tmp/i3lock.png
LOGO=~/i3lock-logo.png
RES=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
# create a darkened, blurred screenshot
ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -filter_complex "boxblur=10,eq=contrast=1:brightness=-0.1:saturation=0.3:gamma=1:gamma_r=1:gamma_g=1:gamma_b=1:gamma_weight=1" -vframes 1 $IMAGE
# add logos / you may want to change "main_w/4" to "main_w/2" if you have only one screen
ffmpeg -i $IMAGE -vf "movie=$LOGO [logo1]; [in][logo1] overlay=(main_w/4-overlay_w/2):(main_h-overlay_h)/2" -codec:a copy "$IMAGE.tmp.png"
# ffmpeg can't replace used files itself / edit them inline
cp "$IMAGE.tmp.png" $IMAGE
rm -f "$IMAGE.tmp.png"
i3lock --insidecolor=ffffff1c --ringcolor=ffffff3e --linecolor=ffffff00 --keyhlcolor=00000080 --ringvercolor=00000000 --insidevercolor=0000001c --ringwrongcolor=00000055 --insidewrongcolor=0000001c -i $IMAGE
rm -f $IMAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment