NSStatusButton Visual Updates & Template

Since -view and various other properties of NSStatusItem are deprecated, it looks like the only way to get supported visual updates is to use +[NSImage imageWithSize:flipped:drawingHandler:] and invalidate the cache to update its display. It doesn't allow realtime animation, but something like a progress indicator doesn't seem too difficult. The only issue is -template doesn't seem to work, even if you use black and CGContext* drawing commands.

An initialization might look like

_item = [NSStatusBar.systemStatusBar statusItemWithLength:NSSquareStatusItemLength];
_item.button.target = self;
_item.button.action = //Some action
_item.button.image = [NSImage imageWithSize:_item.button.bounds.size flipped:false drawingHandler:^BOOL(NSRect dstRect) {
    CGContextRef c = NSGraphicsContext.currentContext.graphicsPort;
    [NSColor.blackColor set];
    //Some drawing
    return true;
}];
_item.button.image.template = true;

Then on update something like

[_item.button.image recache];
[_item.button setNeedsDisplay];

Does anyone have any suggestions to get this more performant, or get -template working? Especially with Dark Mode in Yosemite, it's pretty important.

NSStatusButton Visual Updates & Template
 
 
Q