Fix bugs related to macOS status icon. #480 #474

This commit is contained in:
Federico Terzi 2020-10-23 21:40:05 +02:00
parent dcdae3ad2d
commit 63c28081a6

View File

@ -26,7 +26,6 @@
// Setup status icon
if (show_icon) {
myStatusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
[self setIcon: icon_path];
}
@ -61,16 +60,12 @@
- (void) updateIcon: (char *)iconPath {
if (show_icon) {
[myStatusItem release];
[self setIcon: iconPath];
}
}
- (void) setIcon: (char *)iconPath {
if (show_icon) {
myStatusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
NSString *nsIconPath = [NSString stringWithUTF8String:iconPath];
NSImage *statusImage = [[NSImage alloc] initWithContentsOfFile:nsIconPath];
[statusImage setTemplate:YES];