Fixed type conversion garbage

This commit is contained in:
johnseth97
2024-10-24 23:47:34 -04:00
parent 6c37fe2c26
commit e11fb62627
2 changed files with 7 additions and 8 deletions

View File

@ -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

View File

@ -71,7 +71,8 @@ struct TerminalView<ViewModel: TerminalViewModel>: 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 {