]> git.sev.monster Git - dotfiles.git/blob - bin/lck
more gpg stuff
[dotfiles.git] / bin / lck
1 #!/bin/sh
2
3 # term lock
4 if [ -z "$DISPLAY" ]; then
5         if [ "$OSTYPE" = "freebsd" ]; then
6                 lock -npv
7         else
8                 lock -np
9         fi
10         exit
11 fi
12
13 # xorg lock
14 img=~/tmp/lock.png
15 if [ -f "$img" ]; then
16         # rudimentary attempt to prevent multiple locks
17         # XXX: could block lock and replace with malicious locker to grab password
18         echo "Lock file exists at '$img', exiting"
19         exit 1
20 fi
21 res="$(xdpyinfo | grep dimensions | awk '{print $2}')"
22 scale=0.07
23 ffmpeg -y -loglevel 0 \
24   -s "$res" -f x11grab -i $DISPLAY -i ~/share/lck/overlay.png \
25   -filter_complex "
26     [0]
27       scale=iw * $scale:ih * $scale,
28       noise=alls=2,
29       scale=`echo $res | tr x :`:flags=neighbor,
30       noise=alls=5,
31       gblur=8
32       [composite];
33     [composite]
34       [1] overlay=x=(main_w - overlay_w) / 2 + 0.5:
35                   y=(main_h - overlay_h) / 2
36       [out]" \
37   -map "[out]" -vframes 1 "$img"
38 # pause dunst
39 pkill -USR1 dunst
40 i3lock -nefi "$img"
41 rm "$img"
42 pkill -USR2 dunst
This page took 0.030153 seconds and 4 git commands to generate.