Could also use Hammerspoon (http://www.hammerspoon.org/) for this. It uses Lua but you can invoke processes and modify the toolbar. In addition you can hook into keystrokes, do window management, and all kinds of stuff.
and the upcoming 0.9.44 release will be even more flexible for this sort of use, because the process invoking stuff (http://www.hammerspoon.org/docs/hs.task.html ) will support processes that run indefinitely, so you could do crazy stuff like have a menubar item that shows the most recent line of a log file, or whatever you want :)
-- Creating a simple menubar item
-- Lots of Mac utilities place a small icon in the system menubar to display their
-- status and let you interact with them. We're going to use two of Hammerspoon's
-- extensions to whip up a very simple replacement for the popular utility Caffeine.
local caffeine = hs.menubar.new()
function setCaffeineDisplay(state)
if state then
caffeine:setTitle("AWAKE")
else
caffeine:setTitle("SLEEPY")
end
end
function caffeineClicked()
setCaffeineDisplay(hs.caffeinate.toggle("displayIdle"))
end
if caffeine then
caffeine:setClickCallback(caffeineClicked)
setCaffeineDisplay(hs.caffeinate.get("displayIdle"))
end