Skip to content

Commit

Permalink
Made statusItem imagePosition update based on if title and/or icon ex…
Browse files Browse the repository at this point in the history
…ists on mac
  • Loading branch information
jefvel committed Oct 16, 2018
1 parent 1f3cb00 commit 8af35e2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion systray_darwin.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,27 @@ - (void)applicationWillTerminate:(NSNotification *)aNotification

- (void)setIcon:(NSImage *)image {
statusItem.button.image = image;
statusItem.button.imagePosition = NSImageLeft;
[self updateTitleButtonStyle];
}

- (void)setTitle:(NSString *)title {
statusItem.button.title = title;
[self updateTitleButtonStyle];
}

-(void)updateTitleButtonStyle {
if (statusItem.button.image != nil) {
if ([statusItem.button.title length] == 0) {
statusItem.button.imagePosition = NSImageOnly;
} else {
statusItem.button.imagePosition = NSImageLeft;
}
} else {
statusItem.button.imagePosition = NSNoImage;
}
}


- (void)setTooltip:(NSString *)tooltip {
statusItem.button.toolTip = tooltip;
}
Expand Down

0 comments on commit 8af35e2

Please sign in to comment.