Close app action

I have an app called Vivid that adjusts MacBook screen brightness. The app sits in my macOS menu bar.
Unfortunately, the app stops detecting MacBook Pro display when Apple Vision Pro is connected and disconnected (the MacBook Pro display is being used as only display again).
If the app is restarted, the app detects the MBP display and can adjust the screen brightness.
Any way I can trigger app close when AVP is connected?
I know I can trigger app open when AVP is disconnected. But I wonder how to reliably close the app when AVP connects?

Same as you used the "Screen Did Connect" trigger you can also use the "Screen Did Disconnect" trigger.

To kill Vivid you can use the "Run terminal command" action

/usr/bin/killall Vivid

(best try in terminal whether this works)

Thanks, Andreas! Your app has been one of the best quality apps and the first thing I install on a brand new Mac.

This is the weirdest thing. I didn't even ask for how to detect "Display disconnect" because I assumed it would just work. However...it doesn't seem to work.

This works and I paired it with Display connected (w/ resolution filter) event: /usr/bin/killall Vivid

Display disconnected does not seem to get triggered.
I tried just "Screen/Display Did Disconnect" and set the HUD to show for 5 seconds. Nothing happens nor when I connect AVP (MBP disconnect?) nor when I disconnect AVP.


Do you have any other suggestions I could try?