Skip to content

Commit

Permalink
Better support for macOS dark mode in Arguments config window
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbjornt committed Oct 2, 2023
1 parent 9bff1db commit cbbf9c2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Application/ArgsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ - (void)constructCommandString {
// Interpreter
NSDictionary *defaultAttrs = @{ NSForegroundColorAttributeName: [NSColor blackColor],
NSBackgroundColorAttributeName: [NSColor whiteColor] };
BOOL darkMode = NO;
if (@available(macOS 10.14, *)) {
darkMode = ([[[NSAppearance currentAppearance] name] isEqualToString:NSAppearanceNameDarkAqua]);
}
if (darkMode) {
defaultAttrs = @{ NSForegroundColorAttributeName: [NSColor whiteColor],
NSBackgroundColorAttributeName: [NSColor blackColor] };
[commandTextField setBackgroundColor:[NSColor blackColor]];
}

NSMutableAttributedString *cmdString = [[NSMutableAttributedString alloc] initWithString:[interpreterTextField stringValue] attributes:defaultAttrs];

// Interpreter args
Expand Down
2 changes: 1 addition & 1 deletion Application/Resources/Platypus-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1250</string>
<string>1251</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ScriptExec/SEController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ - (BOOL)isAcceptableFileType:(NSString *)file {
NSError *outErr = nil;
NSString *fileType = [WORKSPACE typeOfFile:file error:&outErr];
if (fileType == nil) {
NSLog(@"Unable to determine file type for %@: %@", file, [outErr localizedDescription]);
DLog(@"Unable to determine file type for %@: %@", file, [outErr localizedDescription]);
} else if ([WORKSPACE type:fileType conformsToType:uti]) {
return YES;
}
Expand Down
4 changes: 2 additions & 2 deletions Shared/PlatypusAppSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ - (BOOL)create {
if (path) {
[data writeToFile:path atomically:NO];
} else {
NSLog(@"Warning: Could not create tmp file named '%@'", name);
DLog(@"Warning: Could not create tmp file named '%@'", name);
}
} else if ([bundledFile isKindOfClass:[NSString class]]) {
bundledFilePath = (NSString *)bundledFile;
Expand Down Expand Up @@ -954,7 +954,7 @@ + (NSString *)bundleIdentifierForAppName:(NSString *)name authorName:(NSString *
// This makes the file uneditable in Interface Builder.
+ (void)optimizeNibFile:(NSString *)nibPath {
if ([FILEMGR fileExistsAtPath:IBTOOL_PATH] == NO) {
NSLog(@"Unable to strip nib file, ibtool not found at path %@", IBTOOL_PATH);
DLog(@"Unable to strip nib file, ibtool not found at path %@", IBTOOL_PATH);
return;
}
NSTask *ibToolTask = [[NSTask alloc] init];
Expand Down
2 changes: 1 addition & 1 deletion Shared/PlatypusScriptUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ + (BOOL)isPotentiallyScriptAtPath:(NSString *)path {

+ (BOOL)hasShebangLineAtPath:(NSString *)path {
if (![FILEMGR isReadableFileAtPath:path]) {
NSLog(@"Unable to read file %@", path);
DLog(@"Unable to read file %@", path);
return NO;
}

Expand Down

0 comments on commit cbbf9c2

Please sign in to comment.