dustinrue / ControlPlane

ControlPlane - context-sensitive computing for OS X
http://www.controlplaneapp.com
BSD 3-Clause "New" or "Revised" License
1.76k stars 181 forks source link

Action to reevaluate and reapply contexts? #473

Closed dionmunk closed 8 years ago

dionmunk commented 8 years ago

I am curious if there is a way to have ControlPlane reevaluate and apply all contexts when a certain action is performed?

Example: Screen unlocks, reevaluate and rerun context actions.

The reason I am asking is that my MacBook will switch audio sources to my monitor on wake. I have ControlPlane switch the audio source when my 'Work' context is detected to Headphones, and it performs this action fine when I first plug into the monitor in the morning. If I leave, lock my Mac, and it goes to sleep while I am away, when I come back and log in, it switches the audio source back to the monitor. ControlPlane does not reapply the context because it is already in the context. I want it to reapply my 'Work' context, though.

dustinrue commented 8 years ago

Are you using single context or multiple context mode?

If you're using single context mode then enable the sleep/wake event evidence source and a new context called sleep. Create a rule that moves to the sleep context when the system is going to sleep. On wake, this context will no longer be true causing ControlPlane to rerun all of the actions prior to sleep.

If you're using multi context it's a bit more involved. You need to convince the system to leave whatever context runs the command to configure your audio when the system is going to sleep. A rule for a sleep event that is negated might do the trick.

dionmunk commented 8 years ago

Ah, I didn't realize I could switch it to Single Context mode. That will do the trick perfectly. Thank you @dustinrue