* Fixed menu icon size

* Added icon for dark mode
* Added detection for interface mode changing from light to dark and adjusting the icon accordingly
This commit is contained in:
Grant Limberg 2016-08-09 20:02:12 -07:00
parent a7b635a980
commit 73fd934fec
6 changed files with 49 additions and 2 deletions

View File

@ -46,4 +46,6 @@
- (void)menuWillOpen:(NSMenu*)menu;
- (void)menuDidClose:(NSMenu*)menu;
- (void)darkModeChanged:(NSNotification*)note;
@end

View File

@ -44,7 +44,19 @@
name:StatusUpdateKey
object:nil];
NSString *osxMode = [defaults stringForKey:@"AppleInterfaceStyle"];
if(osxMode != nil && [osxMode isEqualToString:@"Dark"]) {
self.statusItem.image = [NSImage imageNamed:@"MenuBarIconMacWhite"];
}
else {
self.statusItem.image = [NSImage imageNamed:@"MenuBarIconMac"];
}
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(darkModeChanged:)
name:@"AppleInterfaceThemeChangedNotification"
object:nil];
[self buildMenu];
@ -82,6 +94,9 @@
- (void)applicationWillTerminate:(NSNotification *)aNotification {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self
name:@"AppleInterfaceThemeChangedNotification"
object:nil];
}
- (void)showNetworks {
@ -277,4 +292,15 @@
}
- (void)darkModeChanged:(NSNotification*)note {
NSString *osxMode = [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"];
if(osxMode != nil && [osxMode isEqualToString:@"Dark"]) {
self.statusItem.image = [NSImage imageNamed:@"MenuBarIconMacWhite"];
}
else {
self.statusItem.image = [NSImage imageNamed:@"MenuBarIconMac"];
}
}
@end

View File

@ -7,7 +7,6 @@
},
{
"idiom" : "mac",
"filename" : "MenuBar@2x.png",
"scale" : "2x"
}
],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "mac",
"filename" : "MenubarWhite.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 17 KiB