#!/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.#DEVICE=00:25:CF:AA:A0:ACDEVICE=Marsbard# User to run screensaver asUSER=martianif [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1fiwhile [ 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 5done