YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: overlay resize by scaling all SwiftUI dimensions directly
Louis Beaumonte198bf07895c
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift b/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swiftindex 7e6b106b2..064b6f876 100644--- a/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift+++ b/apps/screenpipe-app-tauri/src-tauri/swift/shortcut_reminder.swift@@ -175,17 +175,19 @@ struct ShortcutReminderView: View {let chatShortcut: Stringlet searchShortcut: Stringlet metrics: OverlayMetrics+ let scale: CGFloatlet onAction: (String) -> Void@Binding var isExpanded: Bool+ // Scaled helpers+ private func s(_ v: CGFloat) -> CGFloat { v * scale }+var body: some View {ZStack {if isExpanded {- // Expanded: full shortcut barexpandedView.transition(.opacity.combined(with: .scale(scale: 0.8, anchor: .trailing)))} else {- // Collapsed: tiny audio-reactive pillcollapsedView.transition(.opacity.combined(with: .scale(scale: 1.2, anchor: .trailing)))}@@ -197,36 +199,32 @@ struct ShortcutReminderView: View {}}- // MARK: - Collapsed pill (live audio + screen viz)+ // MARK: - Collapsed pillprivate var collapsedView: some View {- HStack(spacing: 3) {- // App icon tiny+ HStack(spacing: s(3)) {if let appIcon = NSApp.applicationIconImage {Image(nsImage: appIcon).resizable()- .frame(width: 12, height: 12)+ .frame(width: s(12), height: s(12))}- // Mini audio barsAudioEqualizerView(active: metrics.audioActive, speechRatio: metrics.speechRatio)- .frame(width: 18, height: 12)- // Mini screen capture viz+ .frame(width: s(18), height: s(12))ScreenMatrixView(active: metrics.screenActive, captureFps: metrics.captureFps)- .frame(width: 18, height: 12)+ .frame(width: s(18), height: s(12)).clipShape(RoundedRectangle(cornerRadius: 1))- // Meeting indicatorZStack {Image(systemName: "phone.fill")- .font(.system(size: 6))+ .font(.system(size: s(6))).foregroundColor(metrics.meetingActive ? .white : .white.opacity(0.2))if metrics.meetingActive {Circle().fill(.white)- .frame(width: 4, height: 4)- .offset(x: 5, y: -5)+ .frame(width: s(4), height: s(4))+ .offset(x: s(5), y: s(-5))}}}- .padding(.horizontal, 5)- .frame(height: kBaseCollapsedH)+ .padding(.horizontal, s(5))+ .frame(height: kBaseCollapsedH * scale).background(Capsule().fill(Color.black.opacity(0.75))).overlay(Capsule().stroke(.white.opacity(0.15), lineWidth: 0.5))}@@ -234,45 +232,41 @@ struct ShortcutReminderView: View {// MARK: - Expanded barprivate var expandedView: some View {HStack(spacing: 0) {- // Shortcut buttons- ShortcutCellButton(icon: "rectangle", label: overlayShortcut, colW: nil, edge: .leading) {+ ShortcutCellButton(icon: "rectangle", label: overlayShortcut, colW: nil, edge: .leading, scale: scale) {onAction("open_timeline")}Rectangle().fill(.white.opacity(0.15)).frame(width: 0.5)- ShortcutCellButton(icon: "bubble.left", label: chatShortcut, colW: nil, edge: nil) {+ ShortcutCellButton(icon: "bubble.left", label: chatShortcut, colW: nil, edge: nil, scale: scale) {onAction("open_chat")}Rectangle().fill(.white.opacity(0.15)).frame(width: 0.5)- ShortcutCellButton(icon: "magnifyingglass", label: searchShortcut, colW: nil, edge: nil) {+ ShortcutCellButton(icon: "magnifyingglass", label: searchShortcut, colW: nil, edge: nil, scale: scale) {onAction("open_search")}Rectangle().fill(.white.opacity(0.15)).frame(width: 0.5)- // Audio vizAudioEqualizerView(active: metrics.audioActive, speechRatio: metrics.speechRatio)- .frame(width: 24, height: 12)- .padding(.horizontal, 3)+ .frame(width: s(24), height: s(12))+ .padding(.horizontal, s(3))- // Screen vizScreenMatrixView(active: metrics.screenActive, captureFps: metrics.captureFps)- .frame(width: 24, height: 12)- .padding(.trailing, 2)+ .frame(width: s(24), height: s(12))+ .padding(.trailing, s(2))Rectangle().fill(.white.opacity(0.15)).frame(width: 0.5)- // Meeting + close- HoverIconButton(icon: "phone.fill", isActive: metrics.meetingActive, edge: nil) {+ HoverIconButton(icon: "phone.fill", isActive: metrics.meetingActive, edge: nil, scale: scale) {onAction("toggle_meeting")}- HoverIconButton(icon: "xmark", isActive: false, edge: .trailing) {+ HoverIconButton(icon: "xmark", isActive: false, edge: .trailing, scale: scale) {onAction("close")}}- .frame(height: kBaseExpandedH)+ .frame(height: kBaseExpandedH * scale).background(Capsule().fill(Color.black.opacity(0.8))).overlay(Capsule().stroke(.white.opacity(0.15), lineWidth: 0.5))- .clipShape(Capsule()) // clip hover highlights to capsule shape+ .clipShape(Capsule())}}@@ -283,7 +277,8 @@ struct ShortcutCellButton: View {let icon: Stringlet label: Stringlet colW: CGFloat?- let edge: HorizontalEdge? // .leading = left cap, .trailing = right cap, nil = middle+ let edge: HorizontalEdge?+ let scale: CGFloatlet action: () -> Void@State private var hovered = false@@ -291,15 +286,15 @@ struct ShortcutCellButton: View {Button(action: action) {HStack(spacing: 1) {Image(systemName: icon)- .font(.system(size: 5))+ .font(.system(size: 5 * scale)).foregroundColor(.white.opacity(0.5))Text(label)- .font(Brand.swiftUIMonoFont(size: 7, weight: .medium))+ .font(Brand.swiftUIMonoFont(size: 7 * scale, weight: .medium)).foregroundColor(.white.opacity(0.8)).lineLimit(1).fixedSize()}- .padding(.horizontal, 6)+ .padding(.horizontal, 6 * scale).frame(width: colW).frame(maxHeight: .infinity).background(hovered ? Color.white.opacity(0.12) : Color.clear).contentShape(Rectangle())@@ -314,6 +309,7 @@ struct HoverIconButton: View {let icon: Stringlet isActive: Boollet edge: HorizontalEdge?+ let scale: CGFloatlet action: () -> Void@State private var hovered = false@@ -321,15 +317,15 @@ struct HoverIconButton: View {Button(action: action) {ZStack(alignment: .topTrailing) {Image(systemName: icon)- .font(.system(size: 5, weight: icon == "xmark" ? .medium : .regular))+ .font(.system(size: 5 * scale, weight: icon == "xmark" ? .medium : .regular)).foregroundColor(isActive ? .white : (hovered ? .white : .white.opacity(0.4)))if isActive {Circle().fill(.white)- .frame(width: 3, height: 3)+ .frame(width: 3 * scale, height: 3 * scale).offset(x: 1, y: -1)}}- .frame(width: 16).frame(maxHeight: .infinity)+ .frame(width: 16 * scale).frame(maxHeight: .infinity).background(hovered ? Color.white.opacity(0.12) : Color.clear).contentShape(Rectangle())}@@ -566,6 +562,7 @@ class ShortcutReminderController: NSObject {chatShortcut: chatShortcut,searchShortcut: searchShortcut,metrics: metrics,+ scale: gOverlayScale,onAction: { [weak self] action inself?.sendAction(action)},@@ -578,21 +575,9 @@ class ShortcutReminderController: NSObject {if let hosting = hostingView {hosting.rootView = AnyView(view)} else {- // Size the hosting view at base (1x) dimensions, then scale via layer transform.- // This preserves SwiftUI layout (capsule shapes, etc.) while rendering bigger.- let baseW = kBaseExpandedW- let baseH = kBaseExpandedH- let scale = gOverlayScalelet hosting = NSHostingView(rootView: AnyView(view))- hosting.frame = NSRect(x: 0, y: 0, width: baseW, height: baseH)- // Center the base-sized view in the scaled panel- let panelW = baseW * scale- let panelH = baseH * scale- hosting.frame.origin.x = (panelW - baseW) / 2- hosting.frame.origin.y = (panelH - baseH) / 2- hosting.wantsLayer = true- hosting.layer?.anchorPoint = CGPoint(x: 0.5, y: 0.5)- hosting.layer?.setAffineTransform(CGAffineTransform(scaleX: scale, y: scale))+ hosting.frame = contentView.bounds+ hosting.autoresizingMask = [.width, .height]contentView.addSubview(hosting)self.hostingView = hosting}