How do I automatically quit app when disconnecting the power cable on Macbook Pro?

1

I have a Macbook Pro with macOS Sierra. I have the Suunto Moveslink2 application running in the background, but I really only need the app when I connect my sports watch to my mac (1-2 a day). According to macOS, it uses a lot of battery and I usually forget to quit the app when I disconnect my power cable. Is there any way to make my Mac automatically quit the app every time I unplug?

I do not need the app to start when I connect the power cable again, I can launch the app manually.

stalegjelsten

Posted 2016-12-14T10:29:02.290

Reputation: 66

Answers

0

I finally found a solution for my problem. An app called ControlPlane can actually do what I wanted, but it can also just launch the required app when I connect my sport watch, and quit the app as soon as I disconnect it. My setup right now:

  • Download and install CrashPlane from its website https://www.controlplaneapp.com/
  • A minimal working setup could be (each major bullet point corresponds to a pane in the ControlPlane preferences)
  • Contexts
    • Create a context named Ambit attached
  • Evidence sources
    • enable Attached USB Device. The other sources can be disabled to improve performance
  • Rules
    • Click the plus sign and choose Add ‘attached usb device’ rule
    • If your ambit is connected, it should show up the in uppermost field. Choose context Ambit attached and set the confidence to maximum. Hit OK
  • Actions
    • Add an open file or application action. Choose the Moveslink application (normally /Applications/Moveslink2.app), set the context Ambit attached. The other settings can be left as is (i.e ‘on arrival’, no delay and enabled)
    • Add a quit application action and give the parameter Moveslink2.app. Set the context to Ambit attached and choose On departure.

This working on macOS Sierra v10.12.3, running ControlPlane 1.6.5, the Moveslink2.app from Suunto and the Suunto Ambit3 sport watch.

stalegjelsten

Posted 2016-12-14T10:29:02.290

Reputation: 66