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: notification panel auto-sizes to content instead of fixed height
Louis Beaumont11c907e5854a
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swiftindex 52d096457..e517f45af 100644--- a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift+++ b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift@@ -225,8 +225,7 @@ struct NotificationContentView: View {MarkdownText(payload.body).padding(.horizontal, 14).padding(.top, 4)-- Spacer(minLength: 6)+ .padding(.bottom, 8)// Action buttonsif !payload.actions.isEmpty {@@ -554,12 +553,12 @@ class NotificationPanelController: NSObject {/// Incremented per notification so rapid-fire notifications each restart the timerprivate var epoch: Int = 0- // Panel dimensions — content width is panelWidth minus shadow padding on each side+ // Panel dimensionsprivate static let panelWidth: CGFloat = 360- private static let panelHeight: CGFloat = 300private static let shadowPadding: CGFloat = 20private static let contentWidth: CGFloat = panelWidth - shadowPadding * 2- private static let contentHeight: CGFloat = panelHeight - shadowPadding * 2+ private static let minContentHeight: CGFloat = 120+ private static let maxContentHeight: CGFloat = 400func show(payload: NotificationPayload) {DispatchQueue.main.async { [self] in@@ -618,8 +617,10 @@ class NotificationPanelController: NSObject {}private func createPanel() {+ // Start with a reasonable default; updateContent will resize to fit+ let initialHeight = Self.minContentHeight + Self.shadowPadding * 2let p = ClickablePanel(- contentRect: NSRect(x: 0, y: 0, width: Self.panelWidth, height: Self.panelHeight),+ contentRect: NSRect(x: 0, y: 0, width: Self.panelWidth, height: initialHeight),styleMask: [.nonactivatingPanel, .borderless],backing: .buffered,defer: false@@ -640,7 +641,7 @@ class NotificationPanelController: NSObject {p.sharingType = .readOnly// Use a custom tracking view as the content view- let tracking = HoverTrackingView(frame: NSRect(x: 0, y: 0, width: Self.panelWidth, height: Self.panelHeight))+ let tracking = HoverTrackingView(frame: NSRect(x: 0, y: 0, width: Self.panelWidth, height: initialHeight))tracking.controller = selftracking.autoresizingMask = [.width, .height]p.contentView = tracking@@ -655,8 +656,9 @@ class NotificationPanelController: NSObject {for screen in NSScreen.screens {if NSMouseInRect(mouseLocation, screen.frame, false) {let visible = screen.visibleFrame+ let panelHeight = panel.frame.heightlet x = visible.origin.x + visible.size.width - Self.panelWidth- let y = visible.origin.y + visible.size.height - Self.panelHeight+ let y = visible.origin.y + visible.size.height - panelHeightpanel.setFrameOrigin(NSPoint(x: x, y: y))break}@@ -684,9 +686,10 @@ class NotificationPanelController: NSObject {}})- // Wrap in padding so shadow has room to render within the oversized panel+ // Fixed width, height determined by contentlet view = innerView- .frame(width: Self.contentWidth, height: Self.contentHeight)+ .frame(width: Self.contentWidth)+ .fixedSize(horizontal: false, vertical: true).padding(Self.shadowPadding)let contentView = panel.contentView!@@ -699,6 +702,19 @@ class NotificationPanelController: NSObject {contentView.addSubview(hosting)self.hostingView = hosting}++ // Measure intrinsic content size and resize panel to fit+ if let hosting = hostingView {+ let fittingSize = hosting.fittingSize+ let newHeight = min(max(fittingSize.height, Self.minContentHeight + Self.shadowPadding * 2), Self.maxContentHeight + Self.shadowPadding * 2)+ let currentFrame = panel.frame+ if abs(currentFrame.height - newHeight) > 1 {+ // Anchor top-right: grow downward from top+ let newY = currentFrame.origin.y + currentFrame.height - newHeight+ let newFrame = NSRect(x: currentFrame.origin.x, y: newY, width: Self.panelWidth, height: newHeight)+ panel.setFrame(newFrame, display: true, animate: false)+ }+ }}private func startTimer() {