So i'm having a problem with the image of a NSStatusBar
item, it seems like the image is pushing away from the rest of the menu items as you can see in this picture. But when the menubar is inactive (as in i'm on my other monitor or not in the app) the problem doesn't happen as you can see in this picture. I'm pretty sure that my code is correct though.
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
[statusItem setHighlightMode:YES];
[statusItem setAction:@selector(openWindow)];
[statusItem setTarget:self];
if ([[[NSAppearance currentAppearance] name] containsString:NSAppearanceNameVibrantDark]) {
[statusItem setImage:[NSImage imageNamed:@"whiteMenu.png"]];
} else {
[statusItem setImage:[NSImage imageNamed:@"blackMenu.png"]];
}
I viewed this question: Display image in a cocoa status app but the problem persists, so i'm not sure what else to do, thanks for any help! PS: The problem i think is the NSVariableStatusItemLength
, i tried NSSquareStatusItemLength
but with no luck, also tried setting it myself, but with the same problem, but with little improvement.