5

Is it possible to get a desktop notification when my iSight turns on? It would be optimal if this could go through Growl, but I've tried HardwareGrowler and it doesn't give me a notification.

I know that the green light always turns on when the iSight turns on, but when the iSight turns on just for one second it is possible that I'm not looking at the screen and that I miss the green light, hence a notification that stays on the screen until I close it would be optimal.

I'm on a MacBook Pro 5,3 and I have Mountain Lion 10.8.3.

9
  • I'm guessing the iSight driver is accessed every time. Assuming your filesystem has atime enabled (it does by default), you can check when that driver was last accessed like this: ls -lu /System/Library/Quicktime/QuickTimeUSBVDCDigitizer.component/Contents/MacOS/QuickTimeUSBVDCDigitizer | awk '{print $6,$7,$8}'. Write a script combining that with growlnotify and make it run in the background. Ta-daa!
    – Elliott
    Commented May 17, 2013 at 9:30
  • 1
    I copy pasted the line of code in terminal and got: No such file or directory Commented May 17, 2013 at 10:15
  • @BartArondson Since it's such a long command, there are some problems with the formatting when copying it. So either navigate manually to this directory and run ls -lu or copy the whole command from here. I'll try to get a solution working with Growl, but don't expect that to arrive today. Maybe somebody else is faster than me...
    – gentmatt
    Commented May 17, 2013 at 11:32
  • Thank you, the dropbox link command works. However, running the command shows me a date and time at which I didn't use my iSight. Also turning on Photo Booth (so also the iSight), turning it off again and running the command does not change the displayed date. So it seems that the command is not working as expected. A working solution would be great, but no hurry, I have asked this question in January, I could wait a little more. Commented May 17, 2013 at 11:58
  • I have written an AppleScript application which will notify if a file is accessed. You can download it here. The interval to detect an access is 10s. However, the real problem is knowing what file is uniquely accessed when the camera is used. As long as we don't know that, this application is useless. At the moment is notifies about an access to /System/Library/CoreServices/RawCamera.bundle/Contents/MacOS/RawCamera.
    – gentmatt
    Commented May 17, 2013 at 15:13

2 Answers 2

2

With the help of Growl's documentation about AppleScript support and a little discussion with Bart Arondson and Elliot B in the comments onto the question I've come up with the following AppleScript.

I've saved this script as an application agent which you can add to your login items in System Preferences → Users & Groups → Login Items.

Basically, this application works by detecting if a unique executable related to using the camera is being accessed. Whenever the executable is accessed, the application will notify about it to Growl:

enter image description here

Download

It's important to know that this script monitors access to the executable...

/System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC

Full script

-- check if growl is running in order to avoid the "Choose Application" dialog
tell application "System Events"
    set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell

-- store time of last iSight access
global lastopened
set lastopened to do shell script "ls -lu /System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC | awk '{print $6,$7,$8}'"

-- make the application ready for use with growl
if isRunning then
    tell application id "com.Growl.GrowlHelperApp"

        -- make a list of all the notification types that this script will ever send
        set the allNotificationsList to ¬
            {"iSight access monitor"}

        -- register the script with growl
        register as application ¬
            "iSight access monitor" all notifications allNotificationsList ¬
            default notifications allNotificationsList ¬
            icon of application "FaceTime"

        -- send the first notification right after the application is started
        notify with name ¬
            "iSight access monitor" title ¬
            "iSight access monitor" description ¬
            "last iSight access: 
" & lastopened application name "iSight access monitor"
    end tell
end if

-- monitoring routine: checks every 10s if the VDC executable has been accessed
on idle
    tell application id "com.Growl.GrowlHelperApp"
        set newopen to do shell script "ls -lu /System/Library/Frameworks/CoreMediaIO.framework/Versions/A/Resources/VDC.plugin/Contents/MacOS/VDC | awk '{print $6,$7,$8}'"
        if (newopen is not equal to lastopened) then
            notify with name ¬
                "iSight access monitor" title ¬
                "iSight access monitor" description ¬
                "new iSight access: 
" & newopen application name "iSight access monitor"
            set lastopened to newopen
        end if
    end tell
    return 10 -- interval in seconds
end idle
2
  • Ah, I rejoiced too soon. Citrix Viewer, a remote desktop client, also accesses the VDC file as it opens. It makes sense as it may need access to the camera, but this makes this solutions less perfect. Commented May 17, 2013 at 19:56
  • @BartArondson That's a pity. I hope some knowledgeable mac developer stumbles upon this question an will be able to further improve the answer in the future.
    – gentmatt
    Commented May 17, 2013 at 20:29
0

Micro Snitch does exactly what I was looking for:

Ever wondered if an application records audio through your Mac’s built-in microphone without your knowledge? Or if the camera captures video for no good reason?

With Micro Snitch there’s no doubt anymore. This ultra-light menu bar application operates inconspicuously in the background. It monitors and reports any microphone and camera activity to help you figure out if someone’s spying on you.

It's not free (€4.50 at the time of writing), but I think it's well worth its price.

No affiliation, just a happy user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .