-
-
Save darwin/b8cba040c60f6c192a93 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
+ (void)install { | |
[self acquireLock]; | |
AUTO_LOG(); | |
[self launchCrashWatcher]; | |
[self initDebugSubsystems]; | |
[self sanitizeDefaults]; | |
if (!hasTweak(TTDoNotTouchWindowsOnStartKey)) { | |
if (hasTweak(TTCloseWindowsOnStartKey)) { | |
LOG(@"closing existing windows because of TTCloseWindowsOnStartKey"); | |
[self closeExistingWindows]; | |
} else { | |
NSTimeInterval secondsSinceTerminalLaunch = fabs([[[NSRunningApplication currentApplication] launchDate] timeIntervalSinceNow]); | |
if (secondsSinceTerminalLaunch == 0.0) { | |
// If Terminal is launched via launchd, -[NSRunningApplication launchDate] returns nil | |
// so to get a valid launch date we use GetProcessInfo() instead | |
ProcessInfoRec info; | |
info.processInfoLength = sizeof(ProcessInfoRec); | |
info.processName = nil; | |
info.processAppRef = nil; | |
ProcessSerialNumber psn = {0, kCurrentProcess}; | |
if (GetProcessInformation(&psn, &info) == noErr) { | |
secondsSinceTerminalLaunch = CFAbsoluteTimeGetCurrent() - (CFAbsoluteTime)info.processLaunchDate; | |
} | |
} | |
if ((secondsSinceTerminalLaunch > 0.0) && (secondsSinceTerminalLaunch < CloseWindowsOnStartTimeout)) { | |
LOG(@"closing existing windows because Terminal process is fresh"); | |
[self closeExistingWindows]; | |
} | |
} | |
} | |
[self loadPreferences]; | |
[self loadFeatures]; | |
DCHECK(!gTotalTerminal); | |
gTotalTerminal = [[TotalTerminal alloc] init]; | |
if (![[NSUserDefaults standardUserDefaults] boolForKey:TTDoNotOpenVisorDuringStartup]) { | |
[TOTALTERMINAL buildVisor]; | |
} | |
LOG(@"======== finished booting ========"); | |
booting = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment