Match terminal flash ring padding to browser

This commit is contained in:
Lawrence Chen 2026-02-23 02:37:48 -08:00
parent a3f3e20d72
commit e4379a136c
4 changed files with 24 additions and 7 deletions

View file

@ -4429,16 +4429,29 @@ final class GhosttySurfaceScrollView: NSView {
}
private func updateNotificationRingPath() {
updateOverlayRingPath(layer: notificationRingLayer, bounds: notificationRingOverlayView.bounds)
updateOverlayRingPath(
layer: notificationRingLayer,
bounds: notificationRingOverlayView.bounds,
inset: 2,
radius: 6
)
}
private func updateFlashPath() {
updateOverlayRingPath(layer: flashLayer, bounds: flashOverlayView.bounds)
updateOverlayRingPath(
layer: flashLayer,
bounds: flashOverlayView.bounds,
inset: CGFloat(FocusFlashPattern.ringInset),
radius: CGFloat(FocusFlashPattern.ringCornerRadius)
)
}
private func updateOverlayRingPath(layer: CAShapeLayer, bounds: CGRect) {
let inset: CGFloat = 2
let radius: CGFloat = 6
private func updateOverlayRingPath(
layer: CAShapeLayer,
bounds: CGRect,
inset: CGFloat,
radius: CGFloat
) {
layer.frame = bounds
guard bounds.width > inset * 2, bounds.height > inset * 2 else {
layer.path = nil

View file

@ -255,10 +255,10 @@ struct BrowserPanelView: View {
webView
}
.overlay {
RoundedRectangle(cornerRadius: 10)
RoundedRectangle(cornerRadius: FocusFlashPattern.ringCornerRadius)
.stroke(Color.accentColor.opacity(focusFlashOpacity), lineWidth: 3)
.shadow(color: Color.accentColor.opacity(focusFlashOpacity * 0.35), radius: 10)
.padding(6)
.padding(FocusFlashPattern.ringInset)
.allowsHitTesting(false)
}
.overlay(alignment: .topLeading) {

View file

@ -24,6 +24,8 @@ enum FocusFlashPattern {
static let keyTimes: [Double] = [0, 0.25, 0.5, 0.75, 1]
static let duration: TimeInterval = 0.9
static let curves: [FocusFlashCurve] = [.easeOut, .easeIn, .easeOut, .easeIn]
static let ringInset: Double = 6
static let ringCornerRadius: Double = 10
static var segments: [FocusFlashSegment] {
let stepCount = min(curves.count, values.count - 1, keyTimes.count - 1)

View file

@ -213,6 +213,8 @@ final class FocusFlashPatternTests: XCTestCase {
XCTAssertEqual(FocusFlashPattern.keyTimes, [0, 0.25, 0.5, 0.75, 1])
XCTAssertEqual(FocusFlashPattern.duration, 0.9, accuracy: 0.0001)
XCTAssertEqual(FocusFlashPattern.curves, [.easeOut, .easeIn, .easeOut, .easeIn])
XCTAssertEqual(FocusFlashPattern.ringInset, 6, accuracy: 0.0001)
XCTAssertEqual(FocusFlashPattern.ringCornerRadius, 10, accuracy: 0.0001)
}
func testFocusFlashPatternSegmentsCoverFullDoublePulseTimeline() {