Forked from lululau/emacs-mac-title-bar.patch
Last active
September 11, 2018 18:33
-
-
Save railwaycat/d42c0a9f79aa8adbc646e8a725fcc690 to your computer and use it in GitHub Desktop.
This file contains 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
--- mituharu-emacs-mac-7fdbfba85d54/src/macappkit.m 2018-09-08 21:02:50.000000000 -0400 | |
+++ mituharu-emacs-mac/src/macappkit.m 2018-09-11 13:56:12.000000000 -0400 | |
@@ -2074,6 +2074,18 @@ | |
@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 | |
@@ -2560,6 +2572,19 @@ | |
MRC_RELEASE (visualEffectView); | |
FRAME_BACKGROUND_ALPHA_ENABLED_P (f) = true; | |
} | |
+ | |
+ 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; | |
+ } | |
+ | |
if (floor (NSAppKitVersionNumber) <= NSAppKitVersionNumber10_13 | |
&& FRAME_MAC_DOUBLE_BUFFERED_P (f)) | |
[window.contentView setWantsLayer:YES]; | |
@@ -6015,8 +6040,7 @@ | |
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