summaryrefslogtreecommitdiff
path: root/scripts/.local/bin/lock
blob: 64504076cc96421a0bffe4d6a5e0d2412335ebc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash

icon="$HOME/.local/share/icons/lock.png"
pngfile='/tmp/screen.png'
bmpfile='/tmp/screen.bmp'
glitchedfile="/tmp/sclock_g.bmp"

(( $# )) && { icon=$1; }

# flush keyring passwords
gnome-keyring-daemon -r -d

# generate fancy lock screen
rm "$pngfile"
maim > "$pngfile"

# old method
#convert "$pngfile" -scale 5% -scale 2000% "$pngfile"

# new method with heavy distortion
convert -rotate -90 $pngfile $bmpfile
for a in {1,2,4,5,2}
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 0.2 0.3 $((a*3)) 0.7
    # Rotate it by 90 degrees
    convert -scale $((100/(a)))% -scale $((100*(a)))% -rotate 90 $glitchedfile $bmpfile
done
convert -gamma 0.1 -gravity center -font "Liberation-Mono" \
    -pointsize 200 -channel RGBA -fill '#bf616a' \
    $bmpfile $pngfile

convert "$pngfile" "$icon" -gravity center -composite -matte "$pngfile"


playerctl pause

#sxiv $pngfile

i3lock -u -i "$pngfile"