Move title change timer to SurfaceView and call it from Ghostty.App instead of terminal controllers

This commit is contained in:
Pranav Mangal
2024-12-12 14:58:42 +05:30
parent 146b1f2a1b
commit e35bd431f4
4 changed files with 20 additions and 25 deletions

View File

@@ -53,10 +53,6 @@ class BaseTerminalController: NSWindowController,
/// Fullscreen state management.
private(set) var fullscreenStyle: FullscreenStyle?
var titleChangeDelay: TimeInterval = 0.075
private var titleChangeTimer: Timer?
/// Event monitor (see individual events for why)
private var eventMonitor: Any? = nil
@@ -264,12 +260,9 @@ class BaseTerminalController: NSWindowController,
func titleDidChange(to: String) {
guard let window else { return }
titleChangeTimer?.invalidate()
// Set the main window title
window.title = to
// Set the main window title after a small delay to prevent flicker
titleChangeTimer = Timer.scheduledTimer(withTimeInterval: titleChangeDelay, repeats: false) { _ in
window.title = to
}
}
func pwdDidChange(to: URL?) {