Last active
May 15, 2022 17:36
-
-
Save dnnsmnstrr/37b84f69773c772d0778373ccefbe3a1 to your computer and use it in GitHub Desktop.
Shell script to react to the state of a webcam in macOS Monterey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log stream --predicate 'subsystem contains "com.apple.UVCExtension" and composedMessage contains "Post PowerLog"' --style ndjson | while read LOGLINE | |
do | |
echo ${LOGLINE} | grep -q '"VDCAssistant_Power_State" = Off' && WEBCAM_STATE='Off' | |
echo ${LOGLINE} | grep -q '"VDCAssistant_Power_State" = On' && WEBCAM_STATE='On' | |
echo ${WEBCAM_STATE} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/jptoto/3b2197dd652ef13bd7f3cab0f2152b19