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

Change default overlay to bottom, optimize FlowLayout caching

altic-dev81ad0a75b338
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 51c247b6..4460dc83 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -626,13 +626,13 @@ final class SettingsStore: ObservableObject {
}
}
- /// Where the recording overlay appears (default: top)
+ /// Where the recording overlay appears (default: bottom)
var overlayPosition: OverlayPosition {
get {
guard let raw = self.defaults.string(forKey: Keys.overlayPosition),
let position = OverlayPosition(rawValue: raw)
else {
- return .top // Default to top (current behavior)
+ return .bottom // Default to bottom (menu overlay)
}
return position
}
diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swift
index f1db58d8..e650c252 100644
--- a/Sources/Fluid/Services/NotchOverlayManager.swift
+++ b/Sources/Fluid/Services/NotchOverlayManager.swift
@@ -235,23 +235,6 @@ final class NotchOverlayManager {
// Only update state if we're still the active generation
guard let self = self, self.generation == currentGeneration else { return }
self.state = .visible
- self.disableNotchShadows()
- }
- }
-
- /// Disable system window shadows for notch windows to prevent "gray traces" during animations
- private func disableNotchShadows() {
- // Notch is pure black and matches the bezel, so system shadows look like artifacts.
- // We do this matching what's done in BottomOverlayWindowController.
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
- for window in NSApplication.shared.windows where window.styleMask.contains(.borderless) {
- // Identify candidates: near top of screen or contains Notch in class name
- let isNearTop = (window.screen ?? NSScreen.main)?.frame.maxY ?? 0
- if window.frame.maxY >= isNearTop - 50 || window.className.contains("Notch") {
- window.hasShadow = false
- window.invalidateShadow()
- }
- }
}
}
@@ -420,7 +403,6 @@ final class NotchOverlayManager {
guard self.commandOutputGeneration == currentGeneration else { return }
self.commandOutputState = .visible
- self.disableNotchShadows()
}
/// Hide expanded command output notch - force close regardless of hover state
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index b10e2660..698f70f6 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -1288,16 +1288,27 @@ struct FillerWordsEditor: View {
// MARK: - Flow Layout
struct FlowLayout: Layout {
+ struct Cache {
+ var sizes: [CGSize] = []
+ var positions: [CGPoint] = []
+ var containerSize: CGSize = .zero
+ var lastWidth: CGFloat = 0
+ }
+
var spacing: CGFloat = 8
- func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
- let result = self.arrangeSubviews(proposal: proposal, subviews: subviews)
- return result.size
+ func makeCache(subviews: Subviews) -> Cache {
+ Cache(sizes: Array(repeating: .zero, count: subviews.count))
}
- func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
- let result = self.arrangeSubviews(proposal: proposal, subviews: subviews)
- for (index, position) in result.positions.enumerated() {
+ func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout Cache) -> CGSize {
+ self.arrangeSubviews(proposal: proposal, subviews: subviews, cache: &cache)
+ return cache.containerSize
+ }
+
+ func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout Cache) {
+ self.arrangeSubviews(proposal: proposal, subviews: subviews, cache: &cache)
+ for (index, position) in cache.positions.enumerated() {
subviews[index].place(
at: CGPoint(x: bounds.minX + position.x, y: bounds.minY + position.y),
proposal: .unspecified
@@ -1307,27 +1318,46 @@ struct FlowLayout: Layout {
private func arrangeSubviews(
proposal: ProposedViewSize,
- subviews: Subviews
- ) -> (size: CGSize, positions: [CGPoint]) {
- let maxWidth = proposal.width ?? .infinity
- var positions: [CGPoint] = []
+ subviews: Subviews,
+ cache: inout Cache
+ ) {
+ let proposedWidth = proposal.width ?? 0
+ let maxWidth = proposedWidth > 0 ? proposedWidth : 260
+ let needsLayout = cache.positions.count != subviews.count || cache.lastWidth != maxWidth
+
+ if needsLayout {
+ cache.positions = []
+ cache.positions.reserveCapacity(subviews.count)
+ cache.sizes = Array(repeating: .zero, count: subviews.count)
+ }
+
var x: CGFloat = 0
var y: CGFloat = 0
var rowHeight: CGFloat = 0
- for subview in subviews {
- let size = subview.sizeThatFits(.unspecified)
+ for index in subviews.indices {
+ let size: CGSize
+ if needsLayout {
+ size = subviews[index].sizeThatFits(.unspecified)
+ cache.sizes[index] = size
+ } else {
+ size = cache.sizes[index]
+ }
+
if x + size.width > maxWidth, x > 0 {
x = 0
y += rowHeight + self.spacing
rowHeight = 0
}
- positions.append(CGPoint(x: x, y: y))
+ if needsLayout {
+ cache.positions.append(CGPoint(x: x, y: y))
+ }
rowHeight = max(rowHeight, size.height)
x += size.width + self.spacing
}
- return (CGSize(width: maxWidth, height: y + rowHeight), positions)
+ cache.containerSize = CGSize(width: maxWidth, height: y + rowHeight)
+ cache.lastWidth = maxWidth
}
}