Created
April 6, 2022 15:31
-
-
Save lululau/5477a1389121b1274b6981b5a06b35b7 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
diff -Nur mituharu-emacs-mac-3ff676c2f98c/src/macappkit.m mituharu-emacs-mac-3ff676c2f98c-patched/src/macappkit.m | |
--- mituharu-emacs-mac-3ff676c2f98c/src/macappkit.m 2022-04-06 11:51:42.000000000 +0800 | |
+++ mituharu-emacs-mac-3ff676c2f98c-patched/src/macappkit.m 2022-04-06 23:21:32.000000000 +0800 | |
@@ -1935,6 +1935,17 @@ | |
@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 | |
@@ -2501,6 +2512,20 @@ | |
if (floor (NSAppKitVersionNumber) <= NSAppKitVersionNumber10_13) | |
[window.contentView setWantsLayer:YES]; | |
} | |
+ | |
+ 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.appearance = [NSAppearance appearanceNamed: NSAppearanceNameVibrantLight]; | |
+ } | |
+ | |
if (oldWindow) | |
{ | |
[window setTitle:[oldWindow title]]; | |
@@ -6308,7 +6333,12 @@ | |
NSUserDefaults *defaults = NSUserDefaults.standardUserDefaults; | |
if ([defaults objectForKey:@"ApplePressAndHoldEnabled"] == nil) | |
- [defaults registerDefaults:@{@"ApplePressAndHoldEnabled" : @"NO"}]; | |
+ { | |
+ NSDictionaryOf (NSString *, NSString *) *appDefaults = | |
+ [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