From e11fb62627fda96e92557afdb307a9f9b766832f Mon Sep 17 00:00:00 2001 From: johnseth97 <17620345+johnseth97@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:47:34 -0400 Subject: [PATCH] Fixed type conversion garbage --- .../Features/Terminal/BaseTerminalController.swift | 12 +++++------- macos/Sources/Features/Terminal/TerminalView.swift | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index bdbd9c989..6e4807c1a 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -238,20 +238,18 @@ class BaseTerminalController: NSWindowController, } - func pwdDidChange(to: URL?){ - + func pwdDidChange(to: URL?) { guard let window else { return } - // Get the current working directory from the focused surface - if ghostty.config.macosTitlebarProxyIcon == .visible, let pwd = focusedSurface?.pwd { - // Set the window's representedURL to the current working directory - window.representedURL = URL(fileURLWithPath: pwd) + if ghostty.config.macosTitlebarProxyIcon == .visible { + // Use the 'to' URL directly + window.representedURL = to } else { - // If we don't have a pwd, set representedURL to nil window.representedURL = nil } } + func cellSizeDidChange(to: NSSize) { guard ghostty.config.windowStepResize else { return } self.window?.contentResizeIncrements = to diff --git a/macos/Sources/Features/Terminal/TerminalView.swift b/macos/Sources/Features/Terminal/TerminalView.swift index 633ed5989..768f57d30 100644 --- a/macos/Sources/Features/Terminal/TerminalView.swift +++ b/macos/Sources/Features/Terminal/TerminalView.swift @@ -71,7 +71,8 @@ struct TerminalView: View { guard let proxyURLString = focusedSurface?.pwd else { return nil } - return URL(string: proxyURLString) + // Use fileURLWithPath initializer for file paths + return URL(fileURLWithPath: proxyURLString) } var body: some View {