dustinrue / ControlPlane

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

Multiple Contexts breaks AppleScript 'current context' property #325

Closed dfaulkner closed 10 years ago

dfaulkner commented 10 years ago

In #316 there is a suggestion to use osascript (AppleScript) to retrieve the current context for use in shell scripts:

function current_context {
   osascript -e 'tell application "ControlPlane"' -e 'get current context' -e 'end tell'
}

This was working fine until multiple contexts were introduced. Now, the menu bar icon shows the correct (two) contexts, but using the cited code yields a different, unselected, context entirely. The color of the icon in the menu bar varies. Sometimes it's the color of the context indicated by the osacript, other times it's the color of one of the contexts listed in the menu bar.