There's an open PR that will make this possible.
It doesn't just implement this specific feature, though. It provides a more general approach for i3bar that enables this and many other use cases. This struck us as a good and flexible solution we can get behind.