#!/bin/bash ##################### ### i3lock-sentry ### version="0.7" ####### ##################### fail="1" timestamp=$(date +%s) tmpDir="/dev/shm/lockdetect.$USER" input="$tmpDir/.spylist" image="$tmpDir/${timestamp}.jpg" output="$HOME/fails.html" configDir="$HOME/.config/i3lock" cssFile="$configDir/sentry.css" placeholder="$configDir/placeholder.png" timeFormat="%I:%M%P" DETECT_BROWSER() { xbrowser=$(which x-www-browser 2>/dev/null) [ ! -z "$xbrowser" ] && browser="x-www-browser" [ -z "$browser" ] && browser="xdg-open" } LOCK_FAIL() { [ ! -f "$input" ] && rm "$tmpDir"/* 2>/dev/null mkdir -p "$tmpDir" 2>/dev/null LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/fswebcam "$image" if [ -f "$image" ]; then echo "${timestamp}:$image" >> "$input" else echo "${timestamp}:" >> "$input" fi } LOCK_PARSE() { count="0" if [ -f "$input" ]; then count=$(cat "$input" 2>/dev/null | grep -v ^$ | wc -l) fi if [ "$count" -ge "$fail" ]; then [ ! -f "$cssFile" ] && cp "/etc/xdg/i3lock/sentry.css" "$cssFile" [ ! -f "$placeholder" ] && cp "/etc/xdg/i3lock/placeholder.png" "$placeholder" echo '
' > "$output" echo "