Reduce ghost emoji flash in title bar

This commit is contained in:
Bryan Lee
2025-01-08 14:19:55 +08:00
parent eb40cce45e
commit 0651586339
2 changed files with 6 additions and 11 deletions

View File

@ -10,7 +10,7 @@ protocol TerminalViewDelegate: AnyObject {
/// The title of the terminal should change. /// The title of the terminal should change.
func titleDidChange(to: String) func titleDidChange(to: String)
/// The URL of the pwd should change. /// The URL of the pwd should change.
func pwdDidChange(to: URL?) func pwdDidChange(to: URL?)
@ -56,15 +56,10 @@ struct TerminalView<ViewModel: TerminalViewModel>: View {
// The title for our window // The title for our window
private var title: String { private var title: String {
var title = "👻" if let surfaceTitle = surfaceTitle, !surfaceTitle.isEmpty {
return surfaceTitle
if let surfaceTitle = surfaceTitle {
if (surfaceTitle.count > 0) {
title = surfaceTitle
}
} }
return "👻"
return title
} }
// The pwd of the focused surface as a URL // The pwd of the focused surface as a URL
@ -72,7 +67,7 @@ struct TerminalView<ViewModel: TerminalViewModel>: View {
guard let surfacePwd, surfacePwd != "" else { return nil } guard let surfacePwd, surfacePwd != "" else { return nil }
return URL(fileURLWithPath: surfacePwd) return URL(fileURLWithPath: surfacePwd)
} }
var body: some View { var body: some View {
switch ghostty.readiness { switch ghostty.readiness {
case .loading: case .loading:

View File

@ -12,7 +12,7 @@ extension Ghostty {
// The current title of the surface as defined by the pty. This can be // The current title of the surface as defined by the pty. This can be
// changed with escape codes. This is public because the callbacks go // changed with escape codes. This is public because the callbacks go
// to the app level and it is set from there. // to the app level and it is set from there.
@Published private(set) var title: String = "👻" @Published private(set) var title: String = ""
// The current pwd of the surface as defined by the pty. This can be // The current pwd of the surface as defined by the pty. This can be
// changed with escape codes. // changed with escape codes.