Skip to content

Commit

Permalink
Merge pull request #1 from LEOYoon-Tsaw/DarkMode
Browse files Browse the repository at this point in the history
Support Dark mode
  • Loading branch information
LEOYoon-Tsaw authored Aug 23, 2020
2 parents 0b5eb82 + 1b6a58b commit 9b152de
Show file tree
Hide file tree
Showing 4 changed files with 427 additions and 217 deletions.
2 changes: 0 additions & 2 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSRequiresAquaSystemAppearance</key>
<true/>
<key>SUEnableAutomaticChecks</key>
<true/>
<key>SUFeedURL</key>
Expand Down
20 changes: 15 additions & 5 deletions SquirrelApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,30 @@ -(void)loadSettings {

_enableNotifications =
![[_config getString:@"show_notifications_when"] isEqualToString:@"never"];

[self.panel updateConfig:_config];
[self.panel updateConfig:_config forDarkMode:NO];
if (@available(macOS 10.14, *)) {
[self.panel updateConfig:_config forDarkMode:YES];
}
}

-(void)loadSchemaSpecificSettings:(NSString *)schemaId {
if (schemaId.length == 0 || [schemaId characterAtIndex:0] == '.') {
return;
}
SquirrelConfig *schema = [[SquirrelConfig alloc] init];
if ([schema openWithSchemaId:schemaId baseConfig:self.config] &&
if ([schema openWithSchemaId:schemaId baseConfig:self.config] &&
[schema hasSection:@"style"]) {
[self.panel updateConfig:schema];
[self.panel updateConfig:schema forDarkMode:NO];
} else {
[self.panel updateConfig:self.config];
[self.panel updateConfig:self.config forDarkMode:NO];
}
if (@available(macOS 10.14, *)) {
if ([schema openWithSchemaId:schemaId baseConfig:self.config] &&
[schema hasSection:@"style"]) {
[self.panel updateConfig:schema forDarkMode:YES];
} else {
[self.panel updateConfig:self.config forDarkMode:YES];
}
}
[schema close];
}
Expand Down
3 changes: 2 additions & 1 deletion SquirrelPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

-(void)updateStatus:(NSString*)message;

-(void)updateConfig:(SquirrelConfig*)config;
-(void)updateConfig:(SquirrelConfig*)config
forDarkMode:(BOOL)isDark;

@end
Loading

0 comments on commit 9b152de

Please sign in to comment.