diff --git a/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift b/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift index d4d6b2d24..db712ca3d 100644 --- a/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/OSSurfaceView.swift @@ -45,6 +45,9 @@ extension Ghostty { /// True when the surface is in readonly mode. @Published private(set) var readonly: Bool = false + /// True when the surface should show a highlight effect (e.g., when presented via goto_split). + @Published private(set) var highlighted: Bool = false + init(id: UUID?, frame: CGRect) { self.id = id ?? UUID() super.init(frame: frame) @@ -73,6 +76,14 @@ extension Ghostty { guard let value = notification.userInfo?[Foundation.Notification.Name.ReadonlyKey] as? Bool else { return } readonly = value } + + /// Triggers a brief highlight animation on this surface. + func highlight() { + highlighted = true + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { [weak self] in + self?.highlighted = false + } + } } } diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift index 6f060e0b1..75356ceed 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift @@ -99,9 +99,6 @@ extension Ghostty { /// True when the bell is active. This is set inactive on focus or event. @Published private(set) var bell: Bool = false - /// True when the surface should show a highlight effect (e.g., when presented via goto_split). - @Published private(set) var highlighted: Bool = false - // An initial size to request for a window. This will only affect // then the view is moved to a new window. var initialSize: NSSize? @@ -1576,14 +1573,6 @@ extension Ghostty { } } - /// Triggers a brief highlight animation on this surface. - func highlight() { - highlighted = true - DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { [weak self] in - self?.highlighted = false - } - } - @IBAction func splitRight(_ sender: Any) { guard let surface = self.surface else { return } ghostty_surface_split(surface, GHOSTTY_SPLIT_DIRECTION_RIGHT) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift index 7c961d0f3..81981f7fb 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_UIKit.swift @@ -14,9 +14,6 @@ extension Ghostty { // The current search state. When non-nil, the search overlay should be shown. @Published var searchState: SearchState? - /// True when the surface should show a highlight effect (e.g., when presented via goto_split). - @Published private(set) var highlighted: Bool = false - private(set) var surface: ghostty_surface_t? init(_ app: ghostty_app_t, baseConfig: SurfaceConfiguration? = nil, uuid: UUID? = nil) {