You could use the free oversight tool: Objective-See: OverSight
It allows you to trigger a terminal command when mic/cam is in use on macOS. You can use the shortcuts command line tool to trigger your shortcut (shortcuts run thenameofyourshortcut)
Such a trigger is on my todo list, but it's not easy.
#!/usr/bin/env osascript
--------------------------------------------------------------------------
use scripting additions
--------------------------------------------------------------------------
### IMPLEMENTATION:
on run argv
set {device, state} to {item 2, item 4} of argv
if the device ≠ "microphone" then return false
if the state = "off" then
tell application "Shortcuts Events" to run the shortcut named "MicOff"
else
tell application "Shortcuts Events" to run the shortcut named "MicOn"
end if
end run
(This will trigger shortcuts named MicOff and MicOn, I'm attaching the script zipped to this post) miconoff.applescript.zip (760 Bytes)
I created this script set it to run shortcuts to increase or decrease the brightness of my screen when an alert goes off to lower or decrease my screen brightness via two shortcuts I have set up.
However, it seems to fail because of the opening line:
set {device, state} to {item 2, item 4} of argv
The error returned is: * error "Can’t get item 2. Invalid index." number -1719 from item 2*