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.
In #316 there is a suggestion to use osascript (AppleScript) to retrieve the current context for use in shell scripts:
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.