#!/bin/bash # Ensure the directory for failed fingerprint images exists mkdir -p ~/pictures/failed_finger # Lock the screen with all passed arguments i3lock "$@" & while true; do # Run the fingerprint verification and redirect output to /dev/null fprintd-verify &> /dev/null # Capture the exit code exit_code=$? # Check the exit code if [ $exit_code -eq 0 ]; then pkill i3lock exit 0 elif [ $exit_code -eq 1 ]; then timestamp=$(date "+%Y%m%d_%H%M%S") timestamp_human=$(date -d "${timestamp:0:8} ${timestamp:9:2}:${timestamp:11:2}:${timestamp:13:2}" "+%Y-%h-%d %H:%M:%S") ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 -frames:v 1 ~/pictures/failed_finger/$timestamp.png kdeconnect-cli --device $(kdeconnect-cli -a --id-only) --ping-msg "Failed to unlock at $timestamp_human" fi done