Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Add customizable overlay finishes and appearance controls

altic-deve46a0a0bff75
diff --git a/Sources/Fluid/Persistence/BackupService.swift b/Sources/Fluid/Persistence/BackupService.swift
index cea0052a..42f09c2d 100644
--- a/Sources/Fluid/Persistence/BackupService.swift
+++ b/Sources/Fluid/Persistence/BackupService.swift
@@ -86,6 +86,10 @@ struct SettingsBackupPayload: Codable, Equatable {
let overlayPosition: SettingsStore.OverlayPosition
let overlayBottomOffset: Double
let overlaySize: SettingsStore.OverlaySize
+ let overlayMaterial: SettingsStore.OverlayMaterial?
+ let overlayGlassOpacity: Double?
+ let overlayTint: SettingsStore.OverlayTint?
+ let overlayHighlight: Double?
let transcriptionPreviewCharLimit: Int
let userTypingWPM: Int
let saveTranscriptionHistory: Bool
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index e90f1274..afff234e 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -2175,6 +2175,53 @@ final class SettingsStore: ObservableObject {
}
}
+ enum OverlayMaterial: String, CaseIterable, Codable {
+ case original
+ case smokedGlass
+ case clearGlass
+ case velvet
+ case aurora
+
+ var displayName: String {
+ switch self {
+ case .original: return "Original"
+ case .smokedGlass: return "Smoked Glass"
+ case .clearGlass: return "Clear Glass"
+ case .velvet: return "Velvet"
+ case .aurora: return "Aurora"
+ }
+ }
+ }
+
+ static let overlayGlassOpacityRange = 0.25...1.0
+ static let defaultOverlayGlassOpacity = 0.8
+
+ enum OverlayTint: String, CaseIterable, Codable {
+ case ocean, violet, rose, mint, amber
+ }
+
+ var overlayTint: OverlayTint {
+ get { OverlayTint(rawValue: self.defaults.string(forKey: "OverlayTint") ?? "") ?? .ocean }
+ set {
+ guard newValue != self.overlayTint else { return }
+ objectWillChange.send()
+ self.defaults.set(newValue.rawValue, forKey: "OverlayTint")
+ }
+ }
+
+ var overlayHighlight: Double {
+ get {
+ let value = (self.defaults.object(forKey: "OverlayHighlight") as? NSNumber)?.doubleValue ?? 0.5
+ return value.isFinite ? min(max(value, 0), 1) : 0.5
+ }
+ set {
+ let value = newValue.isFinite ? min(max(newValue, 0), 1) : 0.5
+ guard value != self.overlayHighlight else { return }
+ objectWillChange.send()
+ self.defaults.set(value, forKey: "OverlayHighlight")
+ }
+ }
+
/// Position options for the recording overlay
enum OverlayPosition: String, CaseIterable, Codable {
case top // Top of screen (notch area or floating)
@@ -2274,6 +2321,42 @@ final class SettingsStore: ObservableObject {
}
}
+ var overlayMaterial: OverlayMaterial {
+ get {
+ guard let raw = self.defaults.string(forKey: Keys.overlayMaterial),
+ let material = OverlayMaterial(rawValue: raw)
+ else {
+ return .smokedGlass
+ }
+ return material
+ }
+ set {
+ guard newValue != self.overlayMaterial else { return }
+ objectWillChange.send()
+ self.defaults.set(newValue.rawValue, forKey: Keys.overlayMaterial)
+ }
+ }
+
+ var overlayGlassOpacity: Double {
+ get {
+ guard self.defaults.object(forKey: Keys.overlayGlassOpacity) != nil else {
+ return Self.defaultOverlayGlassOpacity
+ }
+ return Self.normalizedOverlayGlassOpacity(self.defaults.double(forKey: Keys.overlayGlassOpacity))
+ }
+ set {
+ let normalized = Self.normalizedOverlayGlassOpacity(newValue)
+ guard normalized != self.overlayGlassOpacity else { return }
+ objectWillChange.send()
+ self.defaults.set(normalized, forKey: Keys.overlayGlassOpacity)
+ }
+ }
+
+ private static func normalizedOverlayGlassOpacity(_ value: Double) -> Double {
+ guard value.isFinite else { return self.defaultOverlayGlassOpacity }
+ return min(max(value, self.overlayGlassOpacityRange.lowerBound), self.overlayGlassOpacityRange.upperBound)
+ }
+
/// How many recent transcription characters show in overlays (default: 150)
var transcriptionPreviewCharLimit: Int {
get {
@@ -3388,6 +3471,10 @@ final class SettingsStore: ObservableObject {
overlayPosition: self.overlayPosition,
overlayBottomOffset: self.overlayBottomOffset,
overlaySize: self.overlaySize,
+ overlayMaterial: self.overlayMaterial,
+ overlayGlassOpacity: self.overlayGlassOpacity,
+ overlayTint: self.overlayTint,
+ overlayHighlight: self.overlayHighlight,
transcriptionPreviewCharLimit: self.transcriptionPreviewCharLimit,
userTypingWPM: self.userTypingWPM,
saveTranscriptionHistory: self.saveTranscriptionHistory,
@@ -3548,6 +3635,18 @@ final class SettingsStore: ObservableObject {
self.overlayPosition = payload.overlayPosition
self.overlayBottomOffset = payload.overlayBottomOffset
self.overlaySize = payload.overlaySize
+ if let overlayMaterial = payload.overlayMaterial {
+ self.overlayMaterial = overlayMaterial
+ }
+ if let overlayGlassOpacity = payload.overlayGlassOpacity {
+ self.overlayGlassOpacity = overlayGlassOpacity
+ }
+ if let overlayTint = payload.overlayTint {
+ self.overlayTint = overlayTint
+ }
+ if let overlayHighlight = payload.overlayHighlight {
+ self.overlayHighlight = overlayHighlight
+ }
self.transcriptionPreviewCharLimit = payload.transcriptionPreviewCharLimit
self.userTypingWPM = payload.userTypingWPM
self.saveTranscriptionHistory = payload.saveTranscriptionHistory
@@ -5660,6 +5759,8 @@ private extension SettingsStore {
static let overlayBottomOffset = "OverlayBottomOffset"
static let overlayBottomOffsetMigratedTo50 = "OverlayBottomOffsetMigratedTo50"
static let overlaySize = "OverlaySize"
+ static let overlayMaterial = "OverlayMaterial"
+ static let overlayGlassOpacity = "OverlayGlassOpacity"
static let transcriptionPreviewCharLimit = "TranscriptionPreviewCharLimit"
/// Media Playback Control
diff --git a/Sources/Fluid/Theme/Components/BottomOverlaySurface.swift b/Sources/Fluid/Theme/Components/BottomOverlaySurface.swift
new file mode 100644
index 00000000..d9ec9c75
--- /dev/null
+++ b/Sources/Fluid/Theme/Components/BottomOverlaySurface.swift
@@ -0,0 +1,248 @@
+import SwiftUI
+
+/// Visual-only styling for the bottom overlay and its attached menus.
+/// Add another preset here to retry the material without touching overlay behavior or layout.
+struct BottomOverlayAppearance {
+ let usesGlass: Bool
+ let legacyMaterial: Material
+ let glassTint: Color
+ let fallbackFill: Color
+ let tintTop: Color
+ let tintBottom: Color
+ var sheen: Color
+ var edgeTop: Color
+ var edgeBottom: Color
+ let shadowColor: Color
+ let shadowRadius: CGFloat
+ let shadowY: CGFloat
+
+ static let smokedGlass = Self.smokedGlass(opacity: SettingsStore.defaultOverlayGlassOpacity)
+
+ static func resolve(
+ material: SettingsStore.OverlayMaterial,
+ opacity: Double,
+ tint: SettingsStore.OverlayTint = .ocean,
+ highlight: Double = 0.5
+ ) -> Self {
+ var result = self.base(material: material, opacity: self.normalizedOpacity(opacity), tint: tint)
+ if material != .original {
+ let strength = highlight.isFinite ? min(max(highlight, 0), 1) : 0.5
+ result.sheen = Color.white.opacity(strength * (material == .velvet ? 0.05 : 0.18))
+ result.edgeTop = Color.white.opacity(strength * 0.52)
+ result.edgeBottom = Color.white.opacity(strength * 0.12)
+ }
+ return result
+ }
+
+ private static func base(material: SettingsStore.OverlayMaterial, opacity: Double, tint: SettingsStore.OverlayTint) -> Self {
+ switch material {
+ case .original:
+ return .original
+ case .smokedGlass:
+ return self.smokedGlass(opacity: opacity)
+ case .clearGlass:
+ return self.clearGlass(opacity: opacity)
+ case .velvet, .aurora:
+ return BottomOverlayAppearance(
+ usesGlass: material == .aurora,
+ legacyMaterial: .ultraThinMaterial,
+ glassTint: tint.color.opacity(0.25),
+ fallbackFill: Color(red: 0.025, green: 0.03, blue: 0.045),
+ tintTop: tint.color.opacity(material == .velvet ? 0.25 : 0.16 + opacity * 0.25),
+ tintBottom: material == .velvet ? Color.black.opacity(0.45) : tint.companion.opacity(0.12 + opacity * 0.3),
+ sheen: .white.opacity(material == .velvet ? 0.025 : 0.09),
+ edgeTop: tint.color.opacity(0.45),
+ edgeBottom: .white.opacity(0.06),
+ shadowColor: .black.opacity(0.32),
+ shadowRadius: 14,
+ shadowY: 7
+ )
+ }
+ }
+
+ private static let original = BottomOverlayAppearance(
+ usesGlass: false,
+ legacyMaterial: .ultraThinMaterial,
+ glassTint: .clear,
+ fallbackFill: .black,
+ tintTop: .clear,
+ tintBottom: .clear,
+ sheen: .clear,
+ edgeTop: .white.opacity(0.15),
+ edgeBottom: .white.opacity(0.08),
+ shadowColor: Color.black.opacity(0.32),
+ shadowRadius: 14,
+ shadowY: 7
+ )
+
+ private static func smokedGlass(opacity: Double) -> BottomOverlayAppearance {
+ let opacity = self.normalizedOpacity(opacity)
+ return BottomOverlayAppearance(
+ usesGlass: true,
+ legacyMaterial: .ultraThinMaterial,
+ glassTint: Color(red: 0.045, green: 0.075, blue: 0.13).opacity(0.20 + (0.35 * opacity)),
+ fallbackFill: Color(red: 0.035, green: 0.045, blue: 0.065),
+ tintTop: Color(red: 0.065, green: 0.095, blue: 0.15).opacity(0.08 + (0.30 * opacity)),
+ tintBottom: Color.black.opacity(0.22 + (0.45 * opacity)),
+ sheen: Color.white.opacity(0.09),
+ edgeTop: Color.white.opacity(0.26),
+ edgeBottom: Color.white.opacity(0.06),
+ shadowColor: Color.black.opacity(0.34),
+ shadowRadius: 14,
+ shadowY: 7
+ )
+ }
+
+ private static func clearGlass(opacity: Double) -> BottomOverlayAppearance {
+ let opacity = self.normalizedOpacity(opacity)
+ return BottomOverlayAppearance(
+ usesGlass: true,
+ legacyMaterial: .ultraThinMaterial,
+ glassTint: Color(red: 0.06, green: 0.085, blue: 0.13).opacity(0.10 + (0.24 * opacity)),
+ fallbackFill: Color(red: 0.055, green: 0.065, blue: 0.085),
+ tintTop: Color(red: 0.10, green: 0.13, blue: 0.18).opacity(0.04 + (0.16 * opacity)),
+ tintBottom: Color.black.opacity(0.10 + (0.28 * opacity)),
+ sheen: Color.white.opacity(0.11),
+ edgeTop: Color.white.opacity(0.32),
+ edgeBottom: Color.white.opacity(0.09),
+ shadowColor: Color.black.opacity(0.28),
+ shadowRadius: 14,
+ shadowY: 7
+ )
+ }
+
+ private static func normalizedOpacity(_ opacity: Double) -> Double {
+ guard opacity.isFinite else { return SettingsStore.defaultOverlayGlassOpacity }
+ return min(max(opacity, SettingsStore.overlayGlassOpacityRange.lowerBound), SettingsStore.overlayGlassOpacityRange.upperBound)
+ }
+}
+
+private struct BottomOverlaySurfaceModifier: ViewModifier {
+ let appearance: BottomOverlayAppearance
+ let cornerRadius: CGFloat
+ let castsShadow: Bool
+ let showsBorder: Bool
+
+ @Environment(\.accessibilityReduceTransparency) private var reduceTransparency
+ @Environment(\.colorSchemeContrast) private var contrast
+
+ private var shape: RoundedRectangle {
+ RoundedRectangle(cornerRadius: self.cornerRadius, style: .continuous)
+ }
+
+ func body(content: Content) -> some View {
+ content
+ .background {
+ self.materialSurface
+ .overlay {
+ // Color over the opaque fallback is still opaque; preserve personalization.
+ self.shape
+ .fill(
+ LinearGradient(
+ colors: [self.appearance.tintTop, self.appearance.tintBottom],
+ startPoint: .topLeading,
+ endPoint: .bottomTrailing
+ )
+ )
+ .allowsHitTesting(false)
+ }
+ .overlay {
+ if !self.reduceTransparency {
+ self.shape
+ .fill(
+ LinearGradient(
+ stops: [
+ .init(color: self.appearance.sheen, location: 0),
+ .init(color: self.appearance.sheen.opacity(0.22), location: 0.12),
+ .init(color: .clear, location: 0.28),
+ ],
+ startPoint: .top,
+ endPoint: .bottom
+ )
+ )
+ .allowsHitTesting(false)
+ }
+ }
+ .shadow(
+ color: self.castsShadow ? self.appearance.shadowColor : .clear,
+ radius: self.castsShadow ? self.appearance.shadowRadius : 0,
+ x: 0,
+ y: self.castsShadow ? self.appearance.shadowY : 0
+ )
+ }
+ .overlay {
+ if self.showsBorder {
+ self.shape
+ .strokeBorder(
+ LinearGradient(
+ colors: [
+ self.appearance.edgeTop.opacity(self.contrast == .increased ? 1 : 0.72),
+ self.appearance.edgeBottom,
+ ],
+ startPoint: .top,
+ endPoint: .bottom
+ ),
+ lineWidth: self.contrast == .increased ? 1.5 : 1
+ )
+ .allowsHitTesting(false)
+ }
+ }
+ }
+
+ @ViewBuilder
+ private var materialSurface: some View {
+ if self.reduceTransparency || !self.appearance.usesGlass {
+ self.shape.fill(self.appearance.fallbackFill)
+ } else if #available(macOS 26, *) {
+ self.shape
+ .fill(.clear)
+ .glassEffect(.regular.tint(self.appearance.glassTint), in: self.shape)
+ } else {
+ self.shape.fill(self.appearance.legacyMaterial)
+ }
+ }
+}
+
+extension View {
+ func bottomOverlaySurface(
+ _ appearance: BottomOverlayAppearance = .smokedGlass,
+ cornerRadius: CGFloat,
+ castsShadow: Bool = false,
+ showsBorder: Bool = true
+ ) -> some View {
+ self.modifier(
+ BottomOverlaySurfaceModifier(
+ appearance: appearance,
+ cornerRadius: cornerRadius,
+ castsShadow: castsShadow,
+ showsBorder: showsBorder
+ )
+ )
+ }
+}
+
+extension SettingsStore {
+ var bottomOverlayAppearance: BottomOverlayAppearance {
+ .resolve(material: self.overlayMaterial, opacity: self.overlayGlassOpacity, tint: self.overlayTint, highlight: self.overlayHighlight)
+ }
+}
+
+extension SettingsStore.OverlayTint {
+ var color: Color {
+ switch self {
+ case .ocean: return Color(red: 0.15, green: 0.48, blue: 0.85)
+ case .violet: return Color(red: 0.57, green: 0.32, blue: 0.85)
+ case .rose: return Color(red: 0.85, green: 0.3, blue: 0.5)
+ case .mint: return Color(red: 0.15, green: 0.68, blue: 0.5)
+ case .amber: return Color(red: 0.85, green: 0.52, blue: 0.17)
+ }
+ }
+
+ var companion: Color {
+ switch self {
+ case .ocean, .mint: return .indigo
+ case .violet, .rose: return .blue
+ case .amber: return .purple
+ }
+ }
+}
diff --git a/Sources/Fluid/UI/OverlayAppearanceEditor.swift b/Sources/Fluid/UI/OverlayAppearanceEditor.swift
new file mode 100644
index 00000000..9b320fc7
--- /dev/null
+++ b/Sources/Fluid/UI/OverlayAppearanceEditor.swift
@@ -0,0 +1,310 @@
+import SwiftUI
+
+/// Static samples use the production surface and production sizing, without microphone activity.
+struct OverlayAppearanceEditor: View {
+ @ObservedObject private var settings = SettingsStore.shared
+ @Environment(\.theme) private var theme
+ @Environment(\.accessibilityReduceTransparency) private var reduceTransparency
+ @State private var backdrop = 0
+
+ private var isGlass: Bool {
+ [.smokedGlass, .clearGlass, .aurora].contains(self.settings.overlayMaterial)
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 20) {
+ HStack {
+ VStack(alignment: .leading, spacing: 6) {
+ Text("Make it yours")
+ .font(.fluidSystem(size: 26, weight: .bold))
+ Text("A little personality for every thought.")
+ .font(.fluidSystem(size: 13))
+ .foregroundStyle(.secondary)
+ }
+ Spacer()
+ Button {
+ self.settings.overlayMaterial = .smokedGlass
+ self.settings.overlayGlassOpacity = SettingsStore.defaultOverlayGlassOpacity
+ self.settings.overlayTint = .ocean
+ self.settings.overlayHighlight = 0.5
+ } label: {
+ Label("Reset look", systemImage: "arrow.counterclockwise")
+ .font(self.theme.typography.bodyStrong)
+ .padding(.horizontal, 8)
+ .padding(.vertical, 6)
+ }
+ .fluidOutlinedButton()
+ .controlSize(.regular)
+ }
+
+ HStack {
+ Text("Try a backdrop")
+ .font(self.theme.typography.bodyStrong)
+ Spacer()
+ HStack(spacing: 4) {
+ self.backdropOption("Light", symbol: "sun.max.fill", value: 1)
+ self.backdropOption("Dark", symbol: "moon.fill", value: 0)
+ }
+ .padding(4)
+ .background(self.theme.palette.secondaryText.opacity(0.08), in: Capsule())
+ .overlay {
+ Capsule().strokeBorder(self.theme.palette.secondaryText.opacity(0.12), lineWidth: 1)
+ }
+ }
+
+ self.sample
+
+ LazyVGrid(columns: Array(repeating: GridItem(.flexible(minimum: 60), spacing: 10), count: 5), spacing: 10) {
+ ForEach(SettingsStore.OverlayMaterial.allCases, id: \.self) { material in
+ Button {
+ self.settings.overlayMaterial = material
+ } label: {
+ VStack(spacing: 8) {
+ Image(systemName: material.symbol)
+ .font(.system(size: 18, weight: .medium))
+ .foregroundStyle(.white)
+ .frame(maxWidth: .infinity)
+ .frame(height: 48)
+ .bottomOverlaySurface(
+ .resolve(
+ material: material,
+ opacity: self.settings.overlayGlassOpacity,
+ tint: self.settings.overlayTint,
+ highlight: self.settings.overlayHighlight
+ ),
+ cornerRadius: 12
+ )
+ HStack(spacing: 4) {
+ Text(material.displayName)
+ .font(.caption)
+ .multilineTextAlignment(.center)
+ if self.settings.overlayMaterial == material {
+ Image(systemName: "checkmark.circle.fill")
+ }
+ }
+ .foregroundStyle(.primary)
+ .frame(minHeight: 30)
+ }
+ .padding(9)
+ .frame(maxWidth: .infinity)
+ .background(
+ self.settings.overlayMaterial == material ? self.theme.palette.accent.opacity(0.12) : .clear,
+ in: RoundedRectangle(cornerRadius: 16)
+ )
+ .contentShape(RoundedRectangle(cornerRadius: 16))
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel(material.displayName)
+ .accessibilityAddTraits(self.settings.overlayMaterial == material ? .isSelected : [])
+ }
+ }
+ .frame(maxWidth: 720)
+ .frame(maxWidth: .infinity, alignment: .center)
+
+ Text(self.settings.overlayMaterial.detail)
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(.secondary)
+
+ if self.isGlass {
+ self.knob(
+ "Transparency",
+ value: Binding(
+ get: { 1 - self.settings.overlayGlassOpacity },
+ set: { self.settings.overlayGlassOpacity = 1 - $0 }
+ ),
+ range: 0...0.75,
+ low: "Smoky",
+ high: "Airy"
+ )
+ .disabled(self.reduceTransparency)
+ }
+
+ if [.velvet, .aurora].contains(self.settings.overlayMaterial) {
+ HStack(spacing: 12) {
+ Text("Color").font(self.theme.typography.bodySmall)
+ Spacer()
+ ForEach(SettingsStore.OverlayTint.allCases, id: \.self) { tint in
+ Button {
+ self.settings.overlayTint = tint
+ } label: {
+ Circle().fill(tint.color)
+ .frame(width: 26, height: 26)
+ .overlay {
+ if self.settings.overlayTint == tint {
+ Image(systemName: "checkmark")
+ .font(.system(size: 11, weight: .bold))
+ .foregroundStyle(.white)
+ }
+ }
+ .padding(3)
+ .contentShape(Circle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel(tint.rawValue.capitalized)
+ .accessibilityAddTraits(self.settings.overlayTint == tint ? .isSelected : [])
+ }
+ }
+ }
+
+ if self.settings.overlayMaterial != .original {
+ self.knob(
+ "Edge light",
+ value: self.$settings.overlayHighlight,
+ range: 0...1,
+ low: "Soft",
+ high: "Defined"
+ )
+ }
+ if self.reduceTransparency {
+ Text("Reduce Transparency is on in macOS. Glass uses a solid finish.")
+ .font(.caption).foregroundStyle(.secondary)
+ }
+ }
+ }
+
+ private var sample: some View {
+ VStack(spacing: 0) {
+ GeometryReader { proxy in
+ let layout = BottomOverlayView.LayoutConstants.get(for: self.settings.overlaySize)
+ let scale = min(1, max(0.1, (proxy.size.width - 40) / layout.containerWidth))
+ OverlayAppearanceSample(size: self.settings.overlaySize, appearance: self.settings.bottomOverlayAppearance)
+ .scaleEffect(scale)
+ .frame(width: proxy.size.width, height: proxy.size.height)
+ }
+ .frame(height: self.settings.overlaySize == .large ? 210 : 145)
+ .background {
+ LinearGradient(
+ colors: self.backdrop == 0
+ ? [Color(red: 0.12, green: 0.19, blue: 0.28), Color(red: 0.42, green: 0.28, blue: 0.37)]
+ : [.gray.opacity(0.2), .white.opacity(0.8)],
+ startPoint: .topLeading,
+ endPoint: .bottomTrailing
+ )
+ }
+ }
+ .background(self.theme.palette.cardBackground)
+ .clipShape(RoundedRectangle(cornerRadius: 16))
+ }
+
+ private func backdropOption(_ title: String, symbol: String, value: Int) -> some View {
+ let selected = self.backdrop == value
+ return Button {
+ self.backdrop = value
+ } label: {
+ HStack(spacing: 7) {
+ Image(systemName: symbol)
+ .font(.system(size: 12, weight: .semibold))
+ .foregroundStyle(selected ? (value == 1 ? Color.orange : Color.indigo) : self.theme.palette.secondaryText)
+ Text(title)
+ .font(.fluidSystem(size: 12, weight: .semibold))
+ }
+ .foregroundStyle(selected ? self.theme.palette.primaryText : self.theme.palette.secondaryText)
+ .padding(.horizontal, 15)
+ .padding(.vertical, 10)
+ .background {
+ if selected {
+ Capsule()
+ .fill(self.theme.palette.cardBackground)
+ .shadow(color: .black.opacity(0.10), radius: 3, y: 1)
+ }
+ }
+ .contentShape(Capsule())
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel("\(title) sample backdrop")
+ .accessibilityAddTraits(selected ? .isSelected : [])
+ }
+
+ private func knob(_ title: String, value: Binding<Double>, range: ClosedRange<Double>, low: String, high: String) -> some View {
+ VStack(spacing: 6) {
+ HStack {
+ Text(title).font(self.theme.typography.bodySmall)
+ Spacer()
+ Text("\(Int((value.wrappedValue * 100).rounded()))%")
+ .font(.caption.monospacedDigit()).foregroundStyle(.secondary)
+ }
+ HStack {
+ Text(low).font(.caption).foregroundStyle(.secondary).frame(width: 48, alignment: .leading)
+ Slider(value: value, in: range, step: 0.05).accessibilityLabel(title)
+ Text(high).font(.caption).foregroundStyle(.secondary).frame(width: 48, alignment: .trailing)
+ }
+ }
+ }
+}
+
+private struct OverlayAppearanceSample: View {
+ private static let appIcon = NSImage(named: "AppIcon") ?? NSApplication.shared.applicationIconImage ?? NSImage(size: NSSize(width: 32, height: 32))
+ let size: SettingsStore.OverlaySize
+ let appearance: BottomOverlayAppearance
+
+ private var layout: BottomOverlayView.LayoutConstants { .get(for: self.size) }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: self.layout.vPadding / 2) {
+ if self.layout.showsPreview {
+ Text(self.size == .large ? "A little space for your next big idea.\nMake every word feel like you." : "Make every word feel like you.")
+ .font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
+ .foregroundStyle(.white.opacity(0.96))
+ .lineLimit(self.size == .small ? 1 : 3)
+ .frame(maxWidth: .infinity, minHeight: self.size == .large ? self.layout.previewBoxHeight : 20, alignment: .topLeading)
+ }
+ HStack {
+ Image(nsImage: Self.appIcon)
+ .resizable()
+ .interpolation(.high)
+ .scaledToFit()
+ .frame(width: self.layout.iconSize, height: self.layout.iconSize)
+ .accessibilityLabel("FluidVoice")
+ Spacer(minLength: 4)
+ HStack(spacing: self.layout.barSpacing) {
+ ForEach(0..<self.layout.barCount, id: \.self) { index in
+ Capsule()
+ .fill(.white.opacity(0.88))
+ .frame(
+ width: self.layout.barWidth,
+ height: self.layout.minBarHeight + CGFloat([0.1, 0.4, 0.7, 0.25, 0.55, 0.9, 0.45, 0.2, 0.6, 0.4, 0.1][index]) * (self.layout.maxBarHeight - self.layout.minBarHeight)
+ )
+ }
+ }
+ .frame(height: self.layout.waveformHeight)
+ if self.layout.showsModeLabel {
+ Spacer(minLength: 4)
+ Label("Basic", systemImage: "bolt.fill")
+ .font(.fluidSystem(size: self.layout.modeFontSize, weight: .semibold))
+ }
+ if self.layout.showsTopControls {
+ Image(systemName: "chevron.down").font(.system(size: 9))
+ Image(systemName: "ellipsis").padding(.leading, 10)
+ }
+ }
+ .foregroundStyle(.white.opacity(0.85))
+ }
+ .padding(.horizontal, self.layout.hPadding)
+ .padding(.vertical, self.layout.vPadding)
+ .frame(width: self.layout.containerWidth)
+ .bottomOverlaySurface(self.appearance, cornerRadius: self.layout.cornerRadius, castsShadow: true)
+ .preferredColorScheme(.dark)
+ }
+}
+
+private extension SettingsStore.OverlayMaterial {
+ var symbol: String {
+ switch self {
+ case .original: return "circle.fill"
+ case .smokedGlass: return "moon"
+ case .clearGlass: return "drop"
+ case .velvet: return "square.fill"
+ case .aurora: return "sparkles"
+ }
+ }
+
+ var detail: String {
+ switch self {
+ case .original: return "The classic. Solid black, quietly out of the way."
+ case .smokedGlass: return "Dark glass with a soft edge. Familiar, with a little depth."
+ case .clearGlass: return "Light-catching glass that lets your desktop show through."
+ case .velvet: return "A matte, tinted finish. Rich color without transparency."
+ case .aurora: return "Two tones of glass, softly blended. Choose your color."
+ }
+ }
+}
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index c41fe77f..ca034bcc 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -1250,118 +1250,10 @@ struct SettingsView: View {
ThemedCard(style: .standard) {
VStack(alignment: .leading, spacing: 14) {
VStack(alignment: .leading, spacing: 12) {
- HStack {
- VStack(alignment: .leading, spacing: 2) {
- Text("Sensitivity")
- .font(self.theme.typography.bodyStrong)
- .foregroundStyle(self.settingsTitleText)
- Text("Control how sensitive the audio visualizer is to sound input")
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.settingsSecondaryText)
- }
-
- Spacer()
-
- Button("Reset") {
- self.visualizerNoiseThreshold = 0.4
- SettingsStore.shared.visualizerNoiseThreshold = self.visualizerNoiseThreshold
- }
- .fluidOutlinedButton()
- .controlSize(.small)
- }
- .settingsSearchTarget(.overlaySensitivity)
-
- HStack(spacing: 10) {
- Text("More")
- .font(.fluidSystem(.caption))
- .foregroundStyle(self.settingsSecondaryText)
- .frame(width: 36, alignment: .trailing)
-
- Slider(value: self.$visualizerNoiseThreshold, in: 0.01...0.8, step: 0.01)
- .controlSize(.regular)
-
- Text("Less")
- .font(.fluidSystem(.caption))
- .foregroundStyle(self.settingsSecondaryText)
- .frame(width: 36, alignment: .leading)
-
- Text(String(format: "%.2f", self.visualizerNoiseThreshold))
- .font(.fluidSystem(.caption, design: .monospaced))
- .foregroundStyle(self.settingsTertiaryText)
- .frame(width: 36)
- }
-
- Divider().padding(.vertical, 8)
-
- // Overlay Position
- HStack {
- VStack(alignment: .leading, spacing: 2) {
- Text("Overlay Position")
- .font(self.theme.typography.bodyStrong)
- .foregroundStyle(self.settingsTitleText)
- Text("Where the recording indicator appears on screen")
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.settingsSecondaryText)
- }
-
- Spacer()
-
- Picker("", selection: self.$settings.overlayPosition) {
- ForEach(SettingsStore.OverlayPosition.allCases, id: \.self) { position in
- Text(position.displayName).tag(position)
- }
- }
- .pickerStyle(.menu)
- .fluidDropdownStyle()
- .frame(width: 170, alignment: .trailing)
- }
- .settingsSearchTarget(.overlayPosition)
-
- Divider().padding(.vertical, 8)
-
- VStack(alignment: .leading, spacing: 10) {
- HStack(alignment: .top) {
- VStack(alignment: .leading, spacing: 2) {
- Text("Transcription Preview Length")
- .font(self.theme.typography.bodyStrong)
- .foregroundStyle(self.settingsTitleText)
- Text("How many recent characters appear in the notch/pill preview")
- .font(self.theme.typography.bodySmall)
- .foregroundStyle(self.settingsSecondaryText)
- }
-
- Spacer()
-
- Text("\(self.settings.transcriptionPreviewCharLimit) chars")
- .font(.fluidSystem(.caption, design: .monospaced))
- .foregroundStyle(self.settingsSecondaryText)
- }
-
- HStack(spacing: 10) {
- Text("Less")
- .font(.fluidSystem(.caption))
- .foregroundStyle(self.settingsSecondaryText)
- .frame(width: 36, alignment: .trailing)
-
- Slider(
- value: Binding(
- get: { Double(self.settings.transcriptionPreviewCharLimit) },
- set: { self.settings.transcriptionPreviewCharLimit = Int($0.rounded()) }
- ),
- in: Double(SettingsStore.transcriptionPreviewCharLimitRange.lowerBound)...Double(SettingsStore.transcriptionPreviewCharLimitRange.upperBound),
- step: Double(SettingsStore.transcriptionPreviewCharLimitStep)
- )
- .controlSize(.regular)
-
- Text("More")
- .font(.fluidSystem(.caption))
- .foregroundStyle(self.settingsSecondaryText)
- .frame(width: 36, alignment: .leading)
- }
+ if self.settings.overlayPosition == .bottom {
+ self.overlayMaterialSettings
+ Divider().padding(.vertical, 8)
}
- .settingsSearchTarget(.transcriptionPreviewLength)
-
- Divider().padding(.vertical, 4)
HStack {
VStack(alignment: .leading, spacing: 2) {
@@ -1453,6 +1345,124 @@ struct SettingsView: View {
.settingsSearchTarget(.bottomOffset)
}
+ Divider().padding(.vertical, 12)
+ Text("Behavior & placement")
+ .font(self.theme.typography.bodyStrong)
+ .padding(.bottom, 4)
+
+ // Overlay Position
+ HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Overlay Position")
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(self.settingsTitleText)
+ Text("Where the recording indicator appears on screen")
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(self.settingsSecondaryText)
+ }
+
+ Spacer()
+
+ Picker("", selection: self.$settings.overlayPosition) {
+ ForEach(SettingsStore.OverlayPosition.allCases, id: \.self) { position in
+ Text(position.displayName).tag(position)
+ }
+ }
+ .pickerStyle(.menu)
+ .fluidDropdownStyle()
+ .frame(width: 170, alignment: .trailing)
+ }
+ .settingsSearchTarget(.overlayPosition)
+
+ Divider().padding(.vertical, 8)
+
+ HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Sensitivity")
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(self.settingsTitleText)
+ Text("Control how sensitive the audio visualizer is to sound input")
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(self.settingsSecondaryText)
+ }
+
+ Spacer()
+
+ Button("Reset") {
+ self.visualizerNoiseThreshold = 0.4
+ SettingsStore.shared.visualizerNoiseThreshold = self.visualizerNoiseThreshold
+ }
+ .fluidOutlinedButton()
+ .controlSize(.small)
+ }
+ .settingsSearchTarget(.overlaySensitivity)
+
+ HStack(spacing: 10) {
+ Text("More")
+ .font(.fluidSystem(.caption))
+ .foregroundStyle(self.settingsSecondaryText)
+ .frame(width: 36, alignment: .trailing)
+
+ Slider(value: self.$visualizerNoiseThreshold, in: 0.01...0.8, step: 0.01)
+ .controlSize(.regular)
+
+ Text("Less")
+ .font(.fluidSystem(.caption))
+ .foregroundStyle(self.settingsSecondaryText)
+ .frame(width: 36, alignment: .leading)
+
+ Text(String(format: "%.2f", self.visualizerNoiseThreshold))
+ .font(.fluidSystem(.caption, design: .monospaced))
+ .foregroundStyle(self.settingsTertiaryText)
+ .frame(width: 36)
+ }
+
+ Divider().padding(.vertical, 8)
+
+ VStack(alignment: .leading, spacing: 10) {
+ HStack(alignment: .top) {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Transcription Preview Length")
+ .font(self.theme.typography.bodyStrong)
+ .foregroundStyle(self.settingsTitleText)
+ Text("How many recent characters appear in the notch/pill preview")
+ .font(self.theme.typography.bodySmall)
+ .foregroundStyle(self.settingsSecondaryText)
+ }
+
+ Spacer()
+
+ Text("\(self.settings.transcriptionPreviewCharLimit) chars")
+ .font(.fluidSystem(.caption, design: .monospaced))
+ .foregroundStyle(self.settingsSecondaryText)
+ }
+
+ HStack(spacing: 10) {
+ Text("Less")
+ .font(.fluidSystem(.caption))
+ .foregroundStyle(self.settingsSecondaryText)
+ .frame(width: 36, alignment: .trailing)
+
+ Slider(
+ value: Binding(
+ get: { Double(self.settings.transcriptionPreviewCharLimit) },
+ set: { self.settings.transcriptionPreviewCharLimit = Int($0.rounded()) }
+ ),
+ in: Double(SettingsStore.transcriptionPreviewCharLimitRange.lowerBound)...Double(SettingsStore.transcriptionPreviewCharLimitRange.upperBound),
+ step: Double(SettingsStore.transcriptionPreviewCharLimitStep)
+ )
+ .controlSize(.regular)
+
+ Text("More")
+ .font(.fluidSystem(.caption))
+ .foregroundStyle(self.settingsSecondaryText)
+ .frame(width: 36, alignment: .leading)
+ }
+ }
+ .settingsSearchTarget(.transcriptionPreviewLength)
+
+ Divider().padding(.vertical, 4)
+
if self.asr.isRunning {
Text("Settings are disabled during active recording")
.font(.fluidSystem(.caption))
@@ -2253,6 +2263,10 @@ struct SettingsView: View {
}
private extension SettingsView {
+ var overlayMaterialSettings: some View {
+ OverlayAppearanceEditor()
+ }
+
private func shortcutGroup<Content: View>(@ViewBuilder content: () -> Content) -> some View {
VStack(alignment: .leading, spacing: 12, content: content)
}
diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swift
index 95a12503..67f2a80e 100644
--- a/Sources/Fluid/Views/BottomOverlayView.swift
+++ b/Sources/Fluid/Views/BottomOverlayView.swift
@@ -60,6 +60,10 @@ final class BottomOverlayWindowController {
self.window?.isVisible != true || self.window?.alphaValue == 0
}
+ var windowSizeForTests: NSSize? {
+ self.window?.frame.size
+ }
+
private init() {
NotificationCenter.default.addObserver(forName: NSNotification.Name("OverlayOffsetChanged"), object: nil, queue: .main) { [weak self] _ in
Task { @MainActor [weak self] in
@@ -121,11 +125,12 @@ final class BottomOverlayWindowController {
if self.window == nil {
self.createWindow()
}
+ self.parkWindowOffscreen()
// Prepare the complete first frame while the cached panel is still
// offscreen. Revealing the neutral shell first causes a visible flash
// that reads as the overlay appearing twice.
- NotchContentState.shared.setBottomOverlayPresented(true)
+ NotchContentState.shared.setBottomOverlayPresented(false)
NotchContentState.shared.setSpokenSendIndicatorState(.hidden)
NotchContentState.shared.mode = mode
switch mode {
@@ -139,7 +144,8 @@ final class BottomOverlayWindowController {
NotchContentState.shared.setBottomOverlayDismissing(false)
self.targetScreen = OverlayScreenResolver.screenForCurrentPointer()
- self.positionWindow()
+ NotchContentState.shared.setBottomOverlayPresented(true)
+ self.prepareFirstFrameForNewPresentation()
// Submit one complete frame to WindowServer.
self.window?.setAccessibilityChildren(nil)
@@ -394,15 +400,39 @@ final class BottomOverlayWindowController {
}
self.pendingResizeWorkItem?.cancel()
+ let scheduledGeneration = self.presentationGeneration
// Debounce rapid streaming updates to avoid resize thrash.
let resizeWorkItem = DispatchWorkItem { [weak self] in
- self?.updateSizeAndPosition()
+ guard let self, self.presentationGeneration == scheduledGeneration else {
+ Self.overlayBench("bottom_resize_drop reason=stale_generation")
+ return
+ }
+ self.updateSizeAndPosition()
}
self.pendingResizeWorkItem = resizeWorkItem
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: resizeWorkItem)
}
+ /// Reset presentation-local SwiftUI measurements and resolve the empty
+ /// session geometry before the warm panel moves onscreen. Otherwise the
+ /// panel can reveal its previous multiline frame until resize debounce.
+ private func prepareFirstFrameForNewPresentation() {
+ guard let window,
+ let hostingView = window.contentView as? NSHostingView<BottomOverlayView>
+ else { return }
+
+ hostingView.rootView = BottomOverlayView()
+ hostingView.invalidateIntrinsicContentSize()
+ hostingView.layoutSubtreeIfNeeded()
+ let firstFrameSize = hostingView.fittingSize
+ hostingView.frame = NSRect(origin: .zero, size: firstFrameSize)
+ window.setFrame(NSRect(origin: window.frame.origin, size: firstFrameSize), display: false)
+ self.positionWindow()
+ hostingView.layoutSubtreeIfNeeded()
+ hostingView.displayIfNeeded()
+ }
+
/// Update window size based on current SwiftUI content and re-position
private func updateSizeAndPosition() {
if self.isReleaseTransitionActive {
@@ -1483,12 +1513,7 @@ private struct BottomOverlayModeMenuView: View {
}
.padding(.horizontal, 8)
.padding(.vertical, 4)
- .background(Color.black)
- .cornerRadius(8)
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(Color.white.opacity(0.12), lineWidth: 1)
- )
+ .bottomOverlaySurface(self.settings.bottomOverlayAppearance, cornerRadius: 8)
.frame(maxWidth: self.maxWidth)
.preferredColorScheme(.dark)
.onHover { hovering in
@@ -1767,12 +1792,7 @@ private struct BottomOverlayPromptMenuView: View {
}
.padding(.horizontal, 8)
.padding(.vertical, 4)
- .background(Color.black)
- .cornerRadius(8)
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(Color.white.opacity(0.12), lineWidth: 1)
- )
+ .bottomOverlaySurface(self.settings.bottomOverlayAppearance, cornerRadius: 8)
.frame(width: min(self.maxWidth, 250), alignment: .leading)
.preferredColorScheme(.dark)
.onHover { hovering in
@@ -1990,12 +2010,7 @@ private struct BottomOverlayActionsMenuView: View {
}
.padding(.horizontal, 8)
.padding(.vertical, 4)
- .background(Color.black)
- .cornerRadius(8)
- .overlay(
- RoundedRectangle(cornerRadius: 8)
- .stroke(Color.white.opacity(0.12), lineWidth: 1)
- )
+ .bottomOverlaySurface(self.settings.bottomOverlayAppearance, cornerRadius: 8)
.frame(maxWidth: self.maxWidth)
.preferredColorScheme(.dark)
.onHover { hovering in
@@ -2630,27 +2645,7 @@ struct BottomOverlayView: View {
private func richPreviewText(_ previewText: String) -> Text {
Text(previewText)
- .foregroundColor(.white.opacity(0.9))
- }
-
- private var overlayBorderLineWidth: CGFloat {
- self.settings.overlaySize == .large ? 0.8 : 1
- }
-
- private var overlayBorderTopOpacity: Double {
- switch self.settings.overlaySize {
- case .pill: return 0.22 // a touch crisper so the smaller pill reads clearly
- case .large: return 0.10
- default: return 0.15
- }
- }
-
- private var overlayBorderBottomOpacity: Double {
- switch self.settings.overlaySize {
- case .pill: return 0.10
- case .large: return 0.05
- default: return 0.08
- }
+ .foregroundColor(.white.opacity(0.96))
}
private var overlayAnimatedOffsetY: CGFloat {
@@ -3235,7 +3230,7 @@ struct BottomOverlayView: View {
ScrollView(.vertical, showsIndicators: false) {
Text(previewText)
.font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
- .foregroundStyle(.white.opacity(0.9))
+ .foregroundStyle(.white.opacity(0.96))
.multilineTextAlignment(.leading)
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
@@ -3284,7 +3279,7 @@ struct BottomOverlayView: View {
if self.settings.overlaySize == .small {
Text(previewText)
.font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
- .foregroundStyle(.white.opacity(0.9))
+ .foregroundStyle(.white.opacity(0.96))
.multilineTextAlignment(.leading)
.lineLimit(1)
.truncationMode(.head)
@@ -3293,7 +3288,7 @@ struct BottomOverlayView: View {
} else {
Text(previewText)
.font(.fluidSystem(size: self.layout.transFontSize, weight: .medium))
- .foregroundStyle(.white.opacity(0.9))
+ .foregroundStyle(.white.opacity(0.96))
.multilineTextAlignment(.leading)
.lineLimit(Int(self.previewMaxHeight / max(self.estimatedPreviewLineHeight, 1)))
.truncationMode(.head)
@@ -3394,23 +3389,40 @@ struct BottomOverlayView: View {
.padding(.horizontal, self.layout.hPadding)
.padding(.vertical, self.layout.vPadding)
.frame(maxWidth: .infinity, alignment: .center)
- .background(
- ZStack {
- // Solid pitch black background, with a soft drop shadow so the pill lifts
- // off whatever is behind it (pill size only; outer padding reserves room).
- RoundedRectangle(cornerRadius: self.layout.cornerRadius)
- .fill(Color.black)
- .shadow(
- color: Color.black.opacity(self.isPillSize ? 0.32 : 0),
- radius: self.isPillSize ? PillShadowMetrics.radius : 0,
- x: 0,
- y: self.isPillSize ? PillShadowMetrics.yOffset : 0
- )
-
- if self.isPillSize {
- // Glossy border: a bright highlight that slowly rotates around the edge.
- // Paused under reduce-motion to avoid continuous redraws on low-resource Macs.
- if self.reduceMotion || !self.contentState.isBottomOverlayPresented {
+ .bottomOverlaySurface(
+ self.settings.bottomOverlayAppearance,
+ cornerRadius: self.layout.cornerRadius,
+ castsShadow: self.isPillSize,
+ showsBorder: !self.isPillSize
+ )
+ .overlay {
+ if self.isPillSize {
+ // Preserve the pill's existing state animation above the shared material.
+ if self.reduceMotion || !self.contentState.isBottomOverlayPresented || (self.settings.overlayMaterial != .original && self.settings.overlayHighlight == 0) {
+ RoundedRectangle(cornerRadius: self.layout.cornerRadius)
+ .strokeBorder(
+ AngularGradient(
+ gradient: Gradient(stops: [
+ .init(color: .white.opacity(0.06), location: 0.00),
+ .init(color: .white.opacity(0.55), location: 0.13),
+ .init(color: .white.opacity(0.10), location: 0.30),
+ .init(color: .white.opacity(0.03), location: 0.55),
+ .init(color: .white.opacity(0.22), location: 0.80),
+ .init(color: .white.opacity(0.06), location: 1.00),
+ ]),
+ center: .center,
+ angle: .degrees(0)
+ ),
+ lineWidth: 1.2
+ )
+ .opacity(self.settings.overlayMaterial == .original ? 1 : self.settings.overlayHighlight)
+ } else {
+ TimelineView(.animation(minimumInterval: 1.0 / 30.0)) { timeline in
+ let seconds = max(
+ 0,
+ timeline.date.timeIntervalSince(self.borderAnimationStartedAt ?? timeline.date)
+ )
+ let angle = (seconds.truncatingRemainder(dividingBy: 6.0) / 6.0) * 360.0
RoundedRectangle(cornerRadius: self.layout.cornerRadius)
.strokeBorder(
AngularGradient(
@@ -3423,52 +3435,15 @@ struct BottomOverlayView: View {
.init(color: .white.opacity(0.06), location: 1.00),
]),
center: .center,
- angle: .degrees(0)
+ angle: .degrees(angle)
),
lineWidth: 1.2
)
- } else {
- TimelineView(.animation(minimumInterval: 1.0 / 30.0)) { timeline in
- let seconds = max(
- 0,
- timeline.date.timeIntervalSince(self.borderAnimationStartedAt ?? timeline.date)
- )
- let angle = (seconds.truncatingRemainder(dividingBy: 6.0) / 6.0) * 360.0
- RoundedRectangle(cornerRadius: self.layout.cornerRadius)
- .strokeBorder(
- AngularGradient(
- gradient: Gradient(stops: [
- .init(color: .white.opacity(0.06), location: 0.00),
- .init(color: .white.opacity(0.55), location: 0.13),
- .init(color: .white.opacity(0.10), location: 0.30),
- .init(color: .white.opacity(0.03), location: 0.55),
- .init(color: .white.opacity(0.22), location: 0.80),
- .init(color: .white.opacity(0.06), location: 1.00),
- ]),
- center: .center,
- angle: .degrees(angle)
- ),
- lineWidth: 1.2
- )
- }
+ .opacity(self.settings.overlayMaterial == .original ? 1 : self.settings.overlayHighlight)
}
- } else {
- // Inner border
- RoundedRectangle(cornerRadius: self.layout.cornerRadius)
- .strokeBorder(
- LinearGradient(
- colors: [
- Color.white.opacity(self.overlayBorderTopOpacity),
- Color.white.opacity(self.overlayBorderBottomOpacity),
- ],
- startPoint: .top,
- endPoint: .bottom
- ),
- lineWidth: self.overlayBorderLineWidth
- )
}
}
- )
+ }
.frame(maxWidth: .infinity, alignment: .top)
.transaction { transaction in
if self.shouldSuppressPreviewDuringRelease {
diff --git a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
index cce7d2fa..d52b3523 100644
--- a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
+++ b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
@@ -3,9 +3,57 @@ import Combine
import CoreAudio
@testable import FluidVoice_Debug
import Foundation
+import SwiftUI
import XCTest
final class HotkeyShortcutTests: XCTestCase {
+ @MainActor
+ func testOverlayAppearanceRejectsNonfiniteTransparency() {
+ let defaults = UserDefaults.standard
+ let key = "OverlayGlassOpacity"
+ let previous = defaults.object(forKey: key)
+ defer {
+ if let previous { defaults.set(previous, forKey: key) }
+ else { defaults.removeObject(forKey: key) }
+ }
+ for invalid in [Double.nan, .infinity, -.infinity] {
+ SettingsStore.shared.overlayGlassOpacity = invalid
+ XCTAssertEqual(SettingsStore.shared.overlayGlassOpacity, SettingsStore.defaultOverlayGlassOpacity)
+ }
+ SettingsStore.shared.overlayGlassOpacity = -1
+ XCTAssertEqual(SettingsStore.shared.overlayGlassOpacity, 0.25)
+ SettingsStore.shared.overlayGlassOpacity = 2
+ XCTAssertEqual(SettingsStore.shared.overlayGlassOpacity, 1)
+ }
+
+ @MainActor
+ func testOverlayAppearanceFitsNarrowSettingsColumn() {
+ let defaults = UserDefaults.standard
+ let keys = ["OverlaySize", "OverlayMaterial"]
+ let previous = keys.map { defaults.object(forKey: $0) }
+ defer {
+ for (key, value) in zip(keys, previous) {
+ if let value { defaults.set(value, forKey: key) }
+ else { defaults.removeObject(forKey: key) }
+ }
+ }
+ // 800-point minimum window minus sidebar, settings insets, and card padding.
+ for width: CGFloat in [420, 520, 900] {
+ for scheme in [ColorScheme.light, .dark] {
+ for overlaySize in SettingsStore.OverlaySize.allCases {
+ for material in SettingsStore.OverlayMaterial.allCases {
+ defaults.set(overlaySize.rawValue, forKey: keys[0])
+ defaults.set(material.rawValue, forKey: keys[1])
+ let host = NSHostingController(rootView: OverlayAppearanceEditor().environment(\.colorScheme, scheme))
+ let size = host.sizeThatFits(in: NSSize(width: width, height: 10000))
+ XCTAssertLessThanOrEqual(size.width, width + 1, "\(overlaySize) / \(material) at \(width)")
+ XCTAssertTrue(size.height.isFinite)
+ }
+ }
+ }
+ }
+ }
+
func testExplicitCustomPromptMigrationPreservesRulesAndIdentity() throws {
var legacy = SettingsStore.DictationPromptProfile(name: "Brief", prompt: "Keep it short.")
legacy.usesExplicitDictationPrompt = false
@@ -271,6 +319,58 @@ final class HotkeyShortcutTests: XCTestCase {
_ = await controller.hideAndWait()
}
+ @MainActor
+ func testBottomOverlayReopenStartsAtEmptyHeightBeforeQueuedResize() async throws {
+ let defaults = UserDefaults.standard
+ let overlaySizeKey = "OverlaySize"
+ let streamingPreviewKey = "EnableStreamingPreview"
+ let previousOverlaySize = defaults.object(forKey: overlaySizeKey)
+ let previousStreamingPreview = defaults.object(forKey: streamingPreviewKey)
+ defer {
+ if let previousOverlaySize {
+ defaults.set(previousOverlaySize, forKey: overlaySizeKey)
+ } else {
+ defaults.removeObject(forKey: overlaySizeKey)
+ }
+ if let previousStreamingPreview {
+ defaults.set(previousStreamingPreview, forKey: streamingPreviewKey)
+ } else {
+ defaults.removeObject(forKey: streamingPreviewKey)
+ }
+ NotchContentState.shared.updateTranscription("")
+ }
+
+ SettingsStore.shared.overlaySize = .medium
+ SettingsStore.shared.enableStreamingPreview = true
+ let audioPublisher = Just(CGFloat.zero).eraseToAnyPublisher()
+ let controller = BottomOverlayWindowController.shared
+
+ controller.prepare()
+ controller.show(audioPublisher: audioPublisher, mode: .dictation)
+ let emptySize = try XCTUnwrap(controller.windowSizeForTests)
+
+ NotchContentState.shared.updateTranscription(String(repeating: "multiline preview text ", count: 30))
+ controller.refreshSizeForContent()
+ try await Task.sleep(nanoseconds: 120_000_000)
+ let expandedSize = try XCTUnwrap(controller.windowSizeForTests)
+ XCTAssertGreaterThan(expandedSize.height, emptySize.height)
+
+ _ = await controller.hideAndWait()
+ try await Task.sleep(nanoseconds: 100_000_000)
+ controller.show(audioPublisher: audioPublisher, mode: .dictation)
+ let reopenedSize = try XCTUnwrap(controller.windowSizeForTests)
+ XCTAssertEqual(reopenedSize.height, emptySize.height, accuracy: 0.5)
+
+ // A resize queued by the previous presentation must not restore its frame.
+ controller.refreshSizeForContent()
+ controller.hide()
+ controller.show(audioPublisher: audioPublisher, mode: .dictation)
+ try await Task.sleep(nanoseconds: 120_000_000)
+ let rapidReopenSize = try XCTUnwrap(controller.windowSizeForTests)
+ XCTAssertEqual(rapidReopenSize.height, emptySize.height, accuracy: 0.5)
+ _ = await controller.hideAndWait()
+ }
+
func testCoreAudioFrameCountUsesActualBufferChannelLayout() {
XCTAssertEqual(fv_core_audio_buffer_frame_count(512 * 4, 4, 1), 512)
XCTAssertEqual(fv_core_audio_buffer_frame_count(512 * 8, 4, 2), 512)