Last active
October 17, 2017 12:30
-
-
Save yqrashawn/3e69ddb608de835b7abc8bd685f7d20e to your computer and use it in GitHub Desktop.
natural-title-bar.patch
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-b5e5c4a6234d/src/macappkit.m 2017-02-04 13:21:43.000000000 +0800 | |
+++ mituharu-emacs-mac/src/macappkit.m 2017-04-03 14:10:01.000000000 +0800 | |
@@ -1824,6 +1824,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 | |
@@ -2267,6 +2279,19 @@ | |
[window setOpaque:NO]; | |
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; | |
+ } | |
+ | |
[[window contentView] addSubview:emacsView]; | |
[self updateBackingScaleFactor]; | |
@@ -4498,8 +4523,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