#!/bin/sh # # Monitors bluetooth looking for a specific device; if the # device is not present, lock the screen # # Device to look for. Either name or hex address will work. # run "hcitool scan" to discover address and name #DEVICE=00:25:CF:AA:A0:AC DEVICE=Marsbard # User to run screensaver as USER=martian if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 fi while [ 1 = 1 ] do hcitool scan | grep $DEVICE 2>&1 > /dev/null if [ "$?" = "1" ] then su $USER -c "gnome-screensaver-command -a" sleep 60 fi sleep 5 done