aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAksel Kornesjö2018-10-16 13:29:12 +0200
committerAksel Kornesjö2018-10-16 13:29:12 +0200
commit6f103f9f13a325617926c2e66da5ff3e0700f919 (patch)
tree0c8f6f984b0a01b6045366d130b347fd31cbb8e5
parentf644d12312f2231d4677f8382407f81c2880803c (diff)
downloadsystray-6f103f9f13a325617926c2e66da5ff3e0700f919.tar.bz2
Made statusItem imagePosition update based on if title and/or icon exists on mac
-rw-r--r--systray_darwin.m16
1 files changed, 15 insertions, 1 deletions
diff --git a/systray_darwin.m b/systray_darwin.m
index 3e5e2ff..e466948 100644
--- a/systray_darwin.m
+++ b/systray_darwin.m
@@ -65,13 +65,27 @@
- (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;
}