I'm trying to show a popup whenever a USB device is connected. There are a few suggestions to use a launchdaemon with StartOnMount, but this gets triggered every time a computer is unlocked from screensaver. Do you have any suggestions on how to approach this problem?
Sample code below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.popup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/path/to/script.sh</string>
</array>
<key>StartOnMount</key>
<true/>
</dict>
</plist>
#!/bin/bash
date >> /tmp/test.txt
