Is it possible to launch apps when the Mac starts to charge, and close apps when the charger is disconnected?