Is it possible to create an If statement, stateing that when audio stops being played from laptop speakers and goes to my headphone jack (meaning when i plug headphones in to listen to music) a picture will become visible?

If possible what code do i need for the If statment?

Im trying to run my program in the background when windows starts and i want a picture to become visible on top of all programs and other applications that are open for a short amount of time when I first plug my headphones in.