Skip to content

Instantly share code, notes, and snippets.

@RoxasShadow
Last active April 21, 2016 23:10
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RoxasShadow/c23849767fa2b842d41a4cf8000c3950 to your computer and use it in GitHub Desktop.
Save RoxasShadow/c23849767fa2b842d41a4cf8000c3950 to your computer and use it in GitHub Desktop.
while :; do
currentOwner=$(lsof | grep -i VDC | awk -F '[^[:alnum:]]' '{print $NR}')
if [[ "$currentOwner" == "" && "$previousOwner" != "" && "$currentOwner" != "$previousOwner" ]]; then
previousOwner=""
osascript -e "display notification \"Camera deactivated\" with title \"Apple Camera\""
elif [ "$previousOwner" != "$currentOwner" ]; then
previousOwner=$currentOwner
osascript -e "display notification \"Camera activated by $currentOwner\" with title \"Apple Camera\""
fi
sleep 7
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment