Skip to content

Instantly share code, notes, and snippets.

@MatheusMuriel
Created December 11, 2022 00:57
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 MatheusMuriel/6309b592a4e6f9f5120bb846d3e82413 to your computer and use it in GitHub Desktop.
Save MatheusMuriel/6309b592a4e6f9f5120bb846d3e82413 to your computer and use it in GitHub Desktop.
My screenlock script with glitch effect to i3wm
#/bin/sh
# Glichting screen lock script by xzvf
pngfile="/tmp/sclock.png"
bmpfile="/tmp/sclock.bmp"
glitchedfile="/tmp/sclock_g.bmp"
scrot -z $pngfile
# convert to bmp and pixelate
magick convert -rotate 90 $pngfile $bmpfile
for a in {1,2,4}
do
# Glitch it with sox FROM: https://maryknize.com/blog/glitch_art_with_sox_imagemagick_and_vim/
sox -t ul -c 1 -r 48k $bmpfile -t ul $glitchedfile trim 0 90s : echo 1 1 $((a*2)) 0.1
# Rotate it by 90 degrees
magick convert -scale $((100/(a)))% -scale $((100*(a)))% -rotate 90 $glitchedfile $bmpfile
done
# Add lock icon, pixelate and convert back to png
magick convert -gravity center -font "Hack-Bold-Nerd-Font-Complete-Mono" -pointsize 200 -draw "text 0,0 ''" -channel RGBA -fill '#bf616a' $bmpfile $pngfile
i3lock -e -i $pngfile
#feh $pngfile
rm $pngfile $bmpfile $glitchedfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment