diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index ea35790fd..96c9188a7 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -232,9 +232,18 @@ class BaseTerminalController: NSWindowController, func titleDidChange(to: String) { guard let window else { return } - + // Set the main window title window.title = to + + // Get the current working directory from the focused surface + if let pwd = focusedSurface?.pwd { + // Set the window's representedURL to the current working directory + window.representedURL = URL(fileURLWithPath: pwd) + } else { + // If we don't have a pwd, set representedURL to nil + window.representedURL = nil + } } func cellSizeDidChange(to: NSSize) { diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index f43454edd..0b1ff3b72 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -211,7 +211,7 @@ class TerminalController: BaseTerminalController { window.restorationClass = TerminalWindowRestoration.self window.identifier = .init(String(describing: TerminalWindowRestoration.self)) } - + // If window decorations are disabled, remove our title if (!ghostty.config.windowDecorations) { window.styleMask.remove(.titled) }