SwitchResX – System Events - Experimental feature
Apply Display Sets when System Events occur
This feature will let you apply any Display Set whenever a specific system event occurs. Since Display Sets can contain anything from resolution settings to video mirroring, but also AppleScripts, you can set your Mac to do things whenever the System event occurs, even if it's not related to your displays !