diff --git a/Packages/macOS/CmuxCanvasUI/Sources/CmuxCanvasUI/CanvasPaneView.swift b/Packages/macOS/CmuxCanvasUI/Sources/CmuxCanvasUI/CanvasPaneView.swift index 24291da3907b..f91229c7a2b7 100644 --- a/Packages/macOS/CmuxCanvasUI/Sources/CmuxCanvasUI/CanvasPaneView.swift +++ b/Packages/macOS/CmuxCanvasUI/Sources/CmuxCanvasUI/CanvasPaneView.swift @@ -1,6 +1,7 @@ import AppKit import SwiftUI import CmuxCanvas +import CmuxFoundation /// Delegate through which a pane view reports gestures to the canvas root. @MainActor @@ -185,7 +186,7 @@ final class CanvasPaneView: NSView { layer?.borderColor = chrome.isFocused ? NSColor.controlAccentColor.cgColor : NSColor.separatorColor.cgColor - layer?.borderWidth = chrome.isFocused ? 2 : 1 + layer?.borderWidth = chrome.isFocused ? CGFloat.paneIndicatorStrokeWidth : 1 layer?.backgroundColor = paneBackground.cgColor } diff --git a/Packages/macOS/CmuxFoundation/Sources/CmuxFoundation/CGFloat+PaneIndicator.swift b/Packages/macOS/CmuxFoundation/Sources/CmuxFoundation/CGFloat+PaneIndicator.swift new file mode 100644 index 000000000000..4b52fc27fe00 --- /dev/null +++ b/Packages/macOS/CmuxFoundation/Sources/CmuxFoundation/CGFloat+PaneIndicator.swift @@ -0,0 +1,8 @@ +public import CoreGraphics + +extension CGFloat { + /// Stroke width shared by the pane focus and attention indicators: the active + /// pane border, the notification ring, the focus flash and the Canvas focus + /// border. They draw along the same edge, so one width keeps them aligned. + public static let paneIndicatorStrokeWidth: CGFloat = 2 +} diff --git a/Sources/PaneChromeSettings.swift b/Sources/PaneChromeSettings.swift index 1ce1c3aed3a8..fd15c05fe0c7 100644 --- a/Sources/PaneChromeSettings.swift +++ b/Sources/PaneChromeSettings.swift @@ -4,7 +4,6 @@ enum PaneChromeSettings { static let paneBorderColorKey = "paneBorderColor" static let activePaneBorderColorKey = "activePaneBorderColor" static let defaultColorHex = "" - static let activeBorderLineWidth = 2.0 static let didChangeNotification = Notification.Name("cmux.paneChromeSettingsDidChange") static func paneBorderColorHex(defaults: UserDefaults = .standard) -> String? { diff --git a/Sources/Panels/Panel.swift b/Sources/Panels/Panel.swift index c6c036f3ac4c..b1e1db76e2c4 100644 --- a/Sources/Panels/Panel.swift +++ b/Sources/Panels/Panel.swift @@ -1,6 +1,7 @@ import Foundation import Combine import AppKit +import CmuxFoundation /// Type of panel content public enum PanelType: String, Codable, CaseIterable, Sendable { @@ -210,7 +211,7 @@ enum FocusFlashCurve: Equatable { enum PanelOverlayRingMetrics { static let inset: CGFloat = 2 static let cornerRadius: CGFloat = 6 - static let lineWidth: CGFloat = 2.5 + static let lineWidth: CGFloat = .paneIndicatorStrokeWidth static func pathRect(in bounds: CGRect) -> CGRect { bounds.insetBy(dx: inset, dy: inset) diff --git a/Sources/Panels/PanelContentView.swift b/Sources/Panels/PanelContentView.swift index b5fa4ce6f2d7..09924a45c550 100644 --- a/Sources/Panels/PanelContentView.swift +++ b/Sources/Panels/PanelContentView.swift @@ -267,8 +267,12 @@ struct PanelFilePathHeader: View { var body: some View { HStack(spacing: 8) { - CmuxSystemSymbolImage(systemName: iconSystemName, pointSize: 16, tint: .secondary) - .frame(width: 16) + CmuxSystemSymbolImage( + systemName: iconSystemName, + pointSize: RightSidebarChromeMetrics.contentIconFrameSize, + tint: .secondary + ) + .frame(width: RightSidebarChromeMetrics.contentIconFrameSize) Text(filePath) .cmuxFont(size: 11, design: .monospaced) .foregroundStyle(Color(nsColor: foregroundColor).opacity(0.68)) @@ -278,8 +282,8 @@ struct PanelFilePathHeader: View { Spacer(minLength: 8) trailingContent() } - .padding(.horizontal, 12) - .frame(height: 30) + .padding(.horizontal, RightSidebarChromeMetrics.contentIconLeadingPadding) + .frame(height: RightSidebarChromeMetrics.secondaryBarHeight) .background(Color.clear) } } @@ -306,8 +310,16 @@ struct PanelHeaderIconGlyph: View { let systemName: String var body: some View { - CmuxSystemSymbolImage(systemName: systemName, pointSize: 13, tint: .secondary) - .frame(width: 20, height: 20, alignment: .center) + CmuxSystemSymbolImage( + systemName: systemName, + pointSize: RightSidebarChromeMetrics.headerIconSize, + tint: .secondary + ) + .frame( + width: RightSidebarChromeMetrics.headerControlSize, + height: RightSidebarChromeMetrics.headerControlSize, + alignment: .center + ) .contentShape(Rectangle()) } } diff --git a/Sources/TmuxWorkspacePaneOverlayView.swift b/Sources/TmuxWorkspacePaneOverlayView.swift index a04d87654110..e97d3d56eb2c 100644 --- a/Sources/TmuxWorkspacePaneOverlayView.swift +++ b/Sources/TmuxWorkspacePaneOverlayView.swift @@ -89,7 +89,7 @@ struct TmuxWorkspacePaneOverlayView: View { path, with: .color(Color(nsColor: color)), style: StrokeStyle( - lineWidth: CGFloat(PaneChromeSettings.activeBorderLineWidth), + lineWidth: PanelOverlayRingMetrics.lineWidth, lineJoin: .round ) )