Take Control With ControlPlane

by

With the complexity of most modern computers, it can be hard to manage all of it's different functionalities.
Especially security in an open Wi-Fi setting which can be particularly difficult to manage: Turn this on… Turn that off… and remembering to turn it back when you return home can be time consuming and difficult. It's in scenarios, such as this one, where ControlPlane can automate to enhance the functionality of the Mac.

ControlPlane Explained

Think of ControlPlane as a process overseer thats helps to manage a Mac. It looks at all the Evidence Sources available to it, runs them over some Rules, makes a decision based on the Evidence Sources and the Rules to set the Contexts of the Mac.
When the Contexts of the Mac change, ControlPlane executes Actions to manage the situation.

Get Started

The easiest way to get started with ControlPlane is with HomeBrew. If you haven’t installed HomeBrew, yet, check out the Homebrew tutorial.
Once Homebrew is installed, install Cask with these commands:
1
2
brew tap phinze/cask
brew install brew-cask
With HomeBrew and Cask installed, execute the following command:
1
brew cask install controlplane
The advantage of using Cask is that it will automatically install updates for you. With one command, all programs installed with Cask can be updated. This makes keeping a system up-to-date that much easier!
Alternatively, you can download ControlPlane from the developer's web site and install it in the conventional way.
ControlPlane Icon
ControlPlane places an icon of a plane in the status bar. The color of the plane depends upon the current context.
ControlPlane Menu
Clicking on the status bar icon, ControlPlane displays the main menu. This displays the current context, where to go for more information, the ability to check for updates, and the Preferences dialog.
General Preferences
The Preferences dialog is where ControlPlane is managed. In the General tab, the operational options for ControlPlane can be modified. Those options are:
Enabling automatic switching–This allows ControlPlane to switch contexts automatically without your intervention. This should be enabled.
Start ControlPlane at login–This allows ControlPlane to start on login. Since you do not want to remember to launch it, it is best to enable this option.
Use Notifications–This option will cause ControlPlane to display a notification message upon changing context or performing an action. It needs to be on for figuring out the correct rule settings. But when your system is configured, it is best to turn off.
Check for updates on startup–With this option set, ControlPlane will check for a new version every time it is launched. This keeps your system up to date with latest fixes.
Hide from status bar–This option hides the icon in the status bar. I like to keep this unchecked so I can easily see what is the current context. You can set the icon to show just the icon, just the current context, or both.
Use switch smoothing–This gives the context switching more of a dampening effect. What that means is that with this turned on, context switching will be performed more slowly. With it off, the switching is performed quicker, but also sometimes unnecessarily. It is best to keep this option turned on.
Restore previous context when ControlPlane starts–When ControlPlane starts, this options will set the last context state as the current state before starting to calculate a new state. This helps in situations when you turn the computer off while in one context and turn it back on when in a different context. If this option is turned off, then none of the actions for moving context will be ran. But with this on option on, they will.
Use a default context–This option gives you the ability to set a default context. Therefore, if ControlPlane can not figure out a context based on Evidence Sources currently available, then it will use the default context.
Confidence to switch–This option gives you the ability to set a confidence level for the changing of context. If the current evidence is not above the confidence level, then no switching is performed.
Advanced
The Advanced tab is only for the brave. Looking at it gives you an idea of what is going on with ControlPlane, but it is best to leave this area alone. It is very easy to set a parameter wrong that will cripple your computer. I advise to just look, but not touch this area.

Contexts

Once operational parameters are set, there needs to be some Contexts for ControlPlane to monitor. You can think of a context as an operational state of the computer. Without Contexts, there is nothing for ControlPlane to do.
Contexts
I have two main Contexts defined: Home and Not Home.
You can also have sub-contexts by selecting an existing Contexts when you create a new one. Be careful, I kept making new Contexts as sub-contexts without realizing it. But, if you do, just drag it to the left and it will change levels. To create a new Contexts, click on the + button at the lower left hand corner.
Adding a Context
You will see the sub-dialog open asking for the name and color for the new Context. What I like to do is assign a dark main color for the upper level Contexts and lighter shades of that color for the sub-Contexts.
Always check the Preview picked color in status bar check-box so that you can see the color of the Contexts in the ControlPlane icon. Go ahead and create the Contexts you want.

Evidence Sources

With the Contexts define, the Evidence Sources need to be defined. Since selecting an Evidence Sources causes ControlPlane to monitor that source, you do not want any more activated than you will use.
Evidence Sources
The Evidence Sources that I am using are:
  • Active Network Adapter
  • Assigned IP Address
  • Attached USB Device
  • Current Location
  • Nearby Wi-Fi Network
  • Power Source
With these checked, you'll be able to create the rules for when your MacBook is at home and for when it's not.

Rules

The next step is to set up some Rules. Rules are used to relate Evidence Sources to a percentage chance that it relates to a particular Contexts. The hard part is getting the percentage accurate enough to trigger the change of Contexts, but not so close to the border that it switches a whole lot.
Rules
As you can see, there are many rules with various stages on the sliders.  To add a new Rule, click the + button at the lower left hand corner.
Adding a Rule
Each Evidence Source adds to the list of possible Rules that can be used. For my setup on the MacBook Air, I setup a rule for Active Network Adapter and set it to Wi-Fi link active with a percentage of 80% of being Home context.
I added a rule for the Attached USB Device being my G3 Adaptor to a percentage of 90% for the Not Home context. I also setup a Current Location Rule for what my system says is my home (it is really over 100 feet off!) to a Home Context at 100%.
I also set up two Rules for Assigned IP Address. If it was my local networks address range (netmask set to 255.255.255.0), I assigned a 90% to the Home Context. If the address range is for my G3 provider (netmask set to 255.255.0.0 since it could be any number in that range), I assigned a 90% to the Not Home Context.

Actions

Once ControlPlane is changing Contexts, you can set up some Actions to be performed when the Contexts switch.
Actions
Set two ToggleFileSharing Actions. One for turning off file sharing when I enter the Not Home Context and one for turning on file sharing entering the Home Context.
Set two ToggleContextStickiness Actions. One for turning it on when in the Not Home Context and one for turning it off when in the Home Context.
What the ToggleContextStickiness does is force ControlPlane to only switch Context on a 100% certainty. That way, once ControlPlane detects it is Not Home, it will not switch until it is definitely in the Home Context.
Adding an Actions
Set up these Actions by clicking the + button at the lower left hand corner of the Actions list. With these basic Actions set up, the system will now turn on and off File Sharing based on Home or Not Home Contexts.
Advertisement

Alfred and ControlPlane

There is a handy Alfred workflow called Control Tower. You can use it to control ControlPlane. Some of it's options are outdated, but the main functionality keywords work great. I mostly use it to enable/disable ControlPlane.

Conclusion

That is how you set up ControlPlane for turning your file sharing on/off based on context. Using these techniques, you can add other contexts and/or sub-contexts and control other aspects of your computer. That's just the beginning, though, and the possibilities are limited only by your imagination!

Unknown

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.

 

Copyright @ 2013 KrobKnea.

Designed by Next Learn | My partner