diff --git a/systray_darwin.m b/systray_darwin.m index 3e5e2ff9..e4669488 100644 --- a/systray_darwin.m +++ b/systray_darwin.m @@ -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; }