Last active
August 2, 2018 06:45
-
-
Save deftsp/150b9aca706c94af030fdbed67ec1fe9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/macappkit.m b/src/macappkit.m | |
index 4241a5cd53..e52529fc9c 100644 | |
--- a/src/macappkit.m | |
+++ b/src/macappkit.m | |
@@ -2042,6 +2042,18 @@ - (void)showMenuBar | |
@implementation EmacsWindow | |
++ (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(NSWindowStyleMask)styleMask | |
+{ | |
+ NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | |
+ NSString *hideDocumentIcon = [userDefaults stringForKey: @"HideDocumentIcon"]; | |
+ | |
+ if([hideDocumentIcon isEqualToString: @"YES"] && (b == NSWindowDocumentIconButton || b == NSWindowDocumentVersionsButton)) { | |
+ return nil; | |
+ } | |
+ | |
+ return [NSWindow standardWindowButton:b forStyleMask:styleMask]; | |
+} | |
+ | |
- (instancetype)initWithContentRect:(NSRect)contentRect | |
styleMask:(NSWindowStyleMask)windowStyle | |
backing:(NSBackingStoreType)bufferingType | |
@@ -2557,6 +2569,19 @@ - (void)setupWindow | |
if (floor (NSAppKitVersionNumber) <= NSAppKitVersionNumber10_9) | |
[window useOptimizedDrawing:YES]; | |
#endif | |
+ | |
+ NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; | |
+ NSString *transparentTitleBar = [userDefaults stringForKey: @"TransparentTitleBar"]; | |
+ | |
+ if ([transparentTitleBar isEqualToString: @"DARK"]) { | |
+ window.titlebarAppearsTransparent = true; | |
+ window.appearance = [NSAppearance appearanceNamed: NSAppearanceNameVibrantDark]; | |
+ } | |
+ | |
+ if ([transparentTitleBar isEqualToString: @"LIGHT"]) { | |
+ window.titlebarAppearsTransparent = true; | |
+ } | |
+ | |
[[window contentView] addSubview:emacsView]; | |
[self updateBackingScaleFactor]; | |
[self updateEmacsViewIsHiddenOrHasHiddenAncestor]; | |
@@ -5711,8 +5736,7 @@ + (void)initialize | |
if ([defaults objectForKey:@"ApplePressAndHoldEnabled"] == nil) | |
{ | |
NSDictionaryOf (NSString *, NSString *) *appDefaults = | |
- [NSDictionary dictionaryWithObject:@"NO" | |
- forKey:@"ApplePressAndHoldEnabled"]; | |
+ [NSDictionary dictionaryWithObjectsAndKeys:@"NO", @"ApplePressAndHoldEnabled", @"NO", @"TransparentTitleBar", @"NO", @"HideDocumentIcon", nil]; | |
[defaults registerDefaults:appDefaults]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment