Action after headphones plugged

Good day! Is it possible to run some application or script when I plug or unplug headphones?

Imprint | Privacy Policy