I am using AirServer for Airplay on my Mac. As far as I know, AirServer does not provide an interface to run scripts on specific actions. However, I found a AirServer specific message inside the Console app whenever a device connects or disconnects to the service. I also tried the following in Terminal:
log stream | grep "AirServer"
I am looking for an efficient way to run a custom script whenever the process AirServer spills out a specific message (in my case connect/disconnect).
WatchPaths
as I did if it writes to its own log file.