Skip to content

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

fix: embedded timeline scroll via native event swizzle, bump to v2.2.83

Louis Beaumont5762c60bfd8c
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 81e467a3c..af932a18f 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -23,6 +23,10 @@ on:
push:
branches: [main]
+concurrency:
+ group: release-app-${{ github.sha }}
+ cancel-in-progress: true
+
jobs:
check_commit:
runs-on: ubuntu-latest
diff --git a/apps/screenpipe-app-tauri/app/globals.css b/apps/screenpipe-app-tauri/app/globals.css
index 18b2fe0dc..df50c0b32 100644
--- a/apps/screenpipe-app-tauri/app/globals.css
+++ b/apps/screenpipe-app-tauri/app/globals.css
@@ -209,7 +209,7 @@
background-color: hsl(var(--background));
transition: background-color 0ms; /* Instant transition to prevent flash */
}
-
+
body {
@apply bg-background text-foreground !pointer-events-auto !overscroll-none;
}
diff --git a/apps/screenpipe-app-tauri/app/settings/page.tsx b/apps/screenpipe-app-tauri/app/settings/page.tsx
index a1c145232..1729b4e8b 100644
--- a/apps/screenpipe-app-tauri/app/settings/page.tsx
+++ b/apps/screenpipe-app-tauri/app/settings/page.tsx
@@ -298,7 +298,7 @@ function SettingsPageContent() {
const isFullHeight = activeSection === "home" || activeSection === "timeline";
return (
- <div className="min-h-screen bg-background">
+ <div className={cn("bg-background", isFullHeight ? "h-screen overflow-hidden" : "min-h-screen")}>
{/* Transparent titlebar area */}
<div className="h-8 bg-transparent" data-tauri-drag-region></div>
diff --git a/apps/screenpipe-app-tauri/components/rewind/hooks/use-scroll-zoom.ts b/apps/screenpipe-app-tauri/components/rewind/hooks/use-scroll-zoom.ts
index 02eddc230..c703efcbc 100644
--- a/apps/screenpipe-app-tauri/components/rewind/hooks/use-scroll-zoom.ts
+++ b/apps/screenpipe-app-tauri/components/rewind/hooks/use-scroll-zoom.ts
@@ -24,6 +24,12 @@ export function useScrollZoom(opts: {
findNextDevice: (fromIndex: number, dir: 1 | -1) => number;
selectedDeviceId: string;
allDeviceIds: string[];
+ // Search review mode — native scroll navigates between results
+ inSearchReviewMode: boolean;
+ searchResultIndex: number;
+ searchResultsCount: number;
+ navigateToSearchResultRef: React.RefObject<(index: number) => void>;
+ showSearchModal: boolean;
}) {
const {
containerRef,
@@ -39,6 +45,11 @@ export function useScrollZoom(opts: {
findNextDevice,
selectedDeviceId,
allDeviceIds,
+ inSearchReviewMode,
+ searchResultIndex,
+ searchResultsCount,
+ navigateToSearchResultRef,
+ showSearchModal,
} = opts;
// Zoom state — owned here so both scroll handler and TimelineSlider share it
@@ -153,28 +164,25 @@ export function useScrollZoom(opts: {
// Attach scroll/zoom handler so pinch-to-zoom and scroll-to-navigate work.
// Overlay mode: attach to document (wheel events go to window under cursor).
- // Embedded mode: attach to the container element only, so the settings
- // sidebar and other page areas still scroll normally.
+ // Embedded mode: attach to both document AND the container element to ensure
+ // events are captured in Tauri's settings WebviewWindow.
useEffect(() => {
const onWheel = (e: WheelEvent) => {
- // Allow normal scrolling inside panels/dialogs in both overlay and embedded mode
- const isWithinAiPanel = document
- .querySelector(".ai-panel")
- ?.contains(e.target as Node);
- const isWithinAudioPanel = document
- .querySelector(".audio-transcript-panel")
- ?.contains(e.target as Node);
- const isWithinTimelineDialog = document
- .querySelector('[role="dialog"]')
- ?.contains(e.target as Node);
- const isWithinSettingsDialog = document
- .querySelector('[data-settings-dialog]')
- ?.contains(e.target as Node);
-
- if (isWithinAiPanel || isWithinAudioPanel || isWithinTimelineDialog || isWithinSettingsDialog) {
+ // In embedded mode, only handle events within our container
+ if (embedded && containerRef.current && !containerRef.current.contains(e.target as Node)) {
return;
}
+ // Allow normal scrolling inside panels/dialogs
+ const target = e.target as Node;
+ const isWithinExcluded =
+ document.querySelector(".ai-panel")?.contains(target) ||
+ document.querySelector(".audio-transcript-panel")?.contains(target) ||
+ document.querySelector('[role="dialog"]')?.contains(target) ||
+ document.querySelector('[data-settings-dialog]')?.contains(target);
+
+ if (isWithinExcluded) return;
+
// preventDefault to block native browser zoom
e.preventDefault();
@@ -182,11 +190,24 @@ export function useScrollZoom(opts: {
handleScroll(e);
};
- const target = embedded ? containerRef.current : document;
- if (!target) return;
const handler = onWheel as EventListener;
- target.addEventListener("wheel", handler, { passive: false });
- return () => target.removeEventListener("wheel", handler);
+
+ // Attach to window, document, AND container to maximize event capture
+ // across different Tauri window types (NSPanel vs WebviewWindow)
+ window.addEventListener("wheel", handler, { passive: false });
+ document.addEventListener("wheel", handler, { passive: false });
+ const container = containerRef.current;
+ if (container) {
+ container.addEventListener("wheel", handler, { passive: false });
+ }
+
+ return () => {
+ window.removeEventListener("wheel", handler);
+ document.removeEventListener("wheel", handler);
+ if (container) {
+ container.removeEventListener("wheel", handler);
+ }
+ };
}, [handleScroll, embedded]);
// Native trackpad pinch-to-zoom via Tauri event (macOS).
@@ -208,5 +229,126 @@ export function useScrollZoom(opts: {
return () => { unlisten.then((f) => f()); };
}, [setTargetZoom]);
- return { zoomLevel, targetZoom, setTargetZoom };
+ // Native scroll events via Tauri event (macOS).
+ // WKWebView in standard WebviewWindows (settings) consumes trackpad wheel
+ // events at the native level. The Rust side swizzles WKWebView.scrollWheel:
+ // and emits "native-scroll" with deltaX/deltaY/modifier keys.
+ useEffect(() => {
+ // Only use native scroll in embedded mode — overlay gets regular JS wheel events.
+ // Without this guard, scroll would be double-processed in the overlay.
+ if (!embedded) return;
+
+ const unlisten = listen<{
+ deltaX: number;
+ deltaY: number;
+ ctrlKey: boolean;
+ metaKey: boolean;
+ }>("native-scroll", (event) => {
+ const { deltaX, deltaY, ctrlKey, metaKey } = event.payload;
+
+ // Don't intercept scroll when search modal is open — SearchModal
+ // has its own native-scroll listener for scrolling results
+ if (showSearchModal) return;
+
+ pausePlayback();
+
+ // When search results exist, scroll navigates between them.
+ // If not yet in review mode (no result highlighted), start from first/last.
+ if (searchResultsCount > 0) {
+ const direction = Math.sign(deltaY);
+ if (inSearchReviewMode) {
+ if (direction > 0 && searchResultIndex < searchResultsCount - 1) {
+ navigateToSearchResultRef.current(searchResultIndex + 1);
+ } else if (direction < 0 && searchResultIndex > 0) {
+ navigateToSearchResultRef.current(searchResultIndex - 1);
+ }
+ } else {
+ // Enter review mode: scroll down → first result, scroll up → last result
+ navigateToSearchResultRef.current(direction > 0 ? 0 : searchResultsCount - 1);
+ }
+ return;
+ }
+
+ if (hasSearchHighlight) dismissSearchHighlight();
+
+ // Pinch gesture on trackpad sends ctrlKey=true
+ if (ctrlKey || metaKey) {
+ isZoomingRef.current = true;
+ if (zoomTimeoutRef.current) clearTimeout(zoomTimeoutRef.current);
+ zoomTimeoutRef.current = setTimeout(() => {
+ isZoomingRef.current = false;
+ }, 150);
+
+ const zoomDelta = deltaY * 0.008;
+ setTargetZoom((prev) =>
+ Math.min(MAX_ZOOM, Math.max(MIN_ZOOM, prev * (1 + zoomDelta))),
+ );
+ return;
+ }
+
+ if (isZoomingRef.current) return;
+
+ // Navigate frames — same logic as handleScroll but using native deltas
+ const scrollIntensity = Math.abs(deltaY);
+ const direction = Math.sign(deltaY); // native deltaY is already inverted
+
+ const zoomMultiplier = 1 / zoomLevel;
+ const indexChange =
+ direction *
+ Math.min(
+ Infinity,
+ Math.max(1, Math.ceil(
+ Math.pow(scrollIntensity / 50, 1.5) * zoomMultiplier,
+ )),
+ );
+
+ requestAnimationFrame(() => {
+ setCurrentIndex((prevIndex: number) => {
+ let newIndex: number;
+ if (matchingIndices) {
+ let pos = 0;
+ let bestDist = Infinity;
+ for (let j = 0; j < matchingIndices.length; j++) {
+ const dist = Math.abs(matchingIndices[j] - prevIndex);
+ if (dist < bestDist) { bestDist = dist; pos = j; }
+ }
+ const newPos = Math.max(0, Math.min(pos + indexChange, matchingIndices.length - 1));
+ newIndex = matchingIndices[newPos];
+ } else {
+ newIndex = Math.min(
+ Math.max(0, Math.floor(prevIndex + indexChange)),
+ frames.length - 1,
+ );
+ }
+
+ if (newIndex !== prevIndex && frames[newIndex]) {
+ setCurrentFrame(frames[newIndex]);
+ }
+
+ return newIndex;
+ });
+ });
+ });
+ return () => { unlisten.then((f) => f()); };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [embedded, frames, zoomLevel, pausePlayback, matchingIndices, hasSearchHighlight, dismissSearchHighlight, inSearchReviewMode, searchResultIndex, searchResultsCount, showSearchModal]);
+
+ // React onWheel handler for embedded mode — attached directly via JSX prop
+ // as a fallback when addEventListener on document/container doesn't receive events
+ const onContainerWheel = useMemo(() => {
+ return (e: React.WheelEvent) => {
+ const target = e.target as Node;
+ const isWithinExcluded =
+ document.querySelector(".ai-panel")?.contains(target) ||
+ document.querySelector(".audio-transcript-panel")?.contains(target) ||
+ document.querySelector('[role="dialog"]')?.contains(target) ||
+ document.querySelector('[data-settings-dialog]')?.contains(target);
+ if (isWithinExcluded) return;
+
+ e.preventDefault();
+ handleScroll(e.nativeEvent);
+ };
+ }, [embedded, handleScroll]);
+
+ return { zoomLevel, targetZoom, setTargetZoom, onContainerWheel };
}
diff --git a/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx b/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx
index af4fe0884..07ec9f1a3 100644
--- a/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx
@@ -5,6 +5,7 @@ import { Search, X, Loader2, Clock, MessageSquare, User, ArrowLeft, Mic, Volume2
import { useKeywordSearchStore, SearchMatch, UiEventResult } from "@/lib/hooks/use-keyword-search-store";
import { useSearchHighlight } from "@/lib/hooks/use-search-highlight";
import { useSearchFocus } from "./hooks/use-search-focus";
+import { listen } from "@tauri-apps/api/event";
import { useDebounce } from "@/lib/hooks/use-debounce";
import { format, isToday, isYesterday } from "date-fns";
import { cn } from "@/lib/utils";
@@ -290,6 +291,65 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
const { inputRef, inputElRef, focusInput } = useSearchFocus(isOpen);
const gridRef = useRef<HTMLDivElement>(null);
+
+ // Programmatically scroll via native-scroll events (macOS).
+ // WKWebView in settings WebviewWindow doesn't dispatch JS wheel events,
+ // so CSS overflow can't scroll from trackpad. The Rust side swizzles
+ // WKWebView.scrollWheel: and emits "native-scroll" Tauri events instead.
+ // We find the scrollable element under the cursor and apply the delta.
+ useEffect(() => {
+ if (!isOpen || !embedded) return;
+
+ // Track cursor position for hit-testing
+ let mouseX = 0, mouseY = 0;
+ const onMove = (e: MouseEvent) => { mouseX = e.clientX; mouseY = e.clientY; };
+ document.addEventListener("mousemove", onMove);
+
+ const unlisten = listen<{ deltaX: number; deltaY: number; ctrlKey: boolean; metaKey: boolean }>(
+ "native-scroll",
+ (event) => {
+ const { deltaX, deltaY } = event.payload;
+ // Find element under cursor and walk up to nearest scrollable container
+ const target = document.elementFromPoint(mouseX, mouseY);
+ if (!target) return;
+
+ let el: HTMLElement | null = target as HTMLElement;
+ let scrolledY = false;
+ let scrolledX = false;
+
+ while (el) {
+ const style = window.getComputedStyle(el);
+ const overflowY = style.overflowY;
+ const overflowX = style.overflowX;
+
+ // Vertical scroll
+ if (!scrolledY && Math.abs(deltaY) > 0 && (overflowY === "auto" || overflowY === "scroll") && el.scrollHeight > el.clientHeight) {
+ el.scrollTop -= deltaY;
+ scrolledY = true;
+ }
+
+ // Horizontal scroll (trackpad horizontal swipe or shift+scroll)
+ if (!scrolledX && Math.abs(deltaX) > 0 && (overflowX === "auto" || overflowX === "scroll") && el.scrollWidth > el.clientWidth) {
+ el.scrollLeft -= deltaX;
+ scrolledX = true;
+ }
+
+ if (scrolledY && scrolledX) break;
+ el = el.parentElement;
+ }
+
+ // Fallback: vertical scroll the grid if nothing else caught it
+ if (!scrolledY && Math.abs(deltaY) > 0 && gridRef.current) {
+ gridRef.current.scrollTop -= deltaY;
+ }
+ },
+ );
+ return () => {
+ document.removeEventListener("mousemove", onMove);
+ unlisten.then((f) => f());
+ };
+ }, [isOpen, embedded]);
+
// Bump to force search effect re-run (fixes stale debouncedQuery after modal reopen)
const [searchEpoch, setSearchEpoch] = useState(0);
@@ -855,11 +915,16 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =
setIsLoadingMore(true);
const newOffset = ocrOffset + OCR_PAGE_SIZE;
setOcrOffset(newOffset);
- searchKeywords(debouncedQuery, {
+ const opts: { limit: number; offset: number; start_time?: Date; end_time?: Date } = {
limit: OCR_PAGE_SIZE,
offset: newOffset,
- }).finally(() => setIsLoadingMore(false));
- }, [isLoadingMore, hasMoreOcr, debouncedQuery, ocrOffset, searchKeywords]);
+ };
+ if (timeFilter) {
+ opts.start_time = new Date(timeFilter + "T00:00:00");
+ opts.end_time = new Date(timeFilter + "T23:59:59.999");
+ }
+ searchKeywords(debouncedQuery, opts).finally(() => setIsLoadingMore(false));
+ }, [isLoadingMore, hasMoreOcr, debouncedQuery, ocrOffset, searchKeywords, timeFilter]);
// Track if we got fewer results than page size (= no more pages)
useEffect(() => {
@@ -1481,7 +1546,13 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =
{timeRanges.length > 1 && (
<div className="flex gap-1.5 mb-3 overflow-x-auto scrollbar-hide pb-0.5">
<button
- onClick={() => { setTimeFilter(null); setSelectedIndex(0); }}
+ onClick={() => {
+ setTimeFilter(null);
+ setSelectedIndex(0);
+ setOcrOffset(0);
+ setHasMoreOcr(true);
+ searchKeywords(debouncedQuery, { limit: OCR_PAGE_SIZE, offset: 0 });
+ }}
className={cn(
"px-2.5 py-1 text-[11px] rounded-full border transition-colors flex items-center gap-1.5 whitespace-nowrap shrink-0",
!timeFilter
@@ -1495,7 +1566,21 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =
{timeRanges.map((range) => (
<button
key={range.dateKey}
- onClick={() => { setTimeFilter(timeFilter === range.dateKey ? null : range.dateKey); setSelectedIndex(0); }}
+ onClick={() => {
+ const newFilter = timeFilter === range.dateKey ? null : range.dateKey;
+ setTimeFilter(newFilter);
+ setSelectedIndex(0);
+ // Re-query backend with date range for proper pagination
+ setOcrOffset(0);
+ setHasMoreOcr(true);
+ if (newFilter) {
+ const start = new Date(newFilter + "T00:00:00");
+ const end = new Date(newFilter + "T23:59:59.999");
+ searchKeywords(debouncedQuery, { limit: OCR_PAGE_SIZE, offset: 0, start_time: start, end_time: end });
+ } else {
+ searchKeywords(debouncedQuery, { limit: OCR_PAGE_SIZE, offset: 0 });
+ }
+ }}
className={cn(
"px-2.5 py-1 text-[11px] rounded-full border transition-colors flex items-center gap-1 whitespace-nowrap shrink-0",
timeFilter === range.dateKey
@@ -1578,7 +1663,7 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =
</div>
{/* Load more indicator */}
- {(isLoadingMore || (hasMoreOcr && searchResults.length >= OCR_PAGE_SIZE)) && (
+ {(isLoadingMore || (hasMoreOcr && filteredResults.length >= OCR_PAGE_SIZE)) && (
<div className="flex justify-center py-4">
{isLoadingMore ? (
<Loader2 className="w-4 h-4 animate-spin text-muted-foreground" />
diff --git a/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx b/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx
index c4b40c9fb..631510d10 100644
--- a/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/thumbnail-highlight-overlay.tsx
@@ -46,7 +46,9 @@ export const ThumbnailHighlightOverlay = memo(function ThumbnailHighlightOverlay
b.bounds.width * b.bounds.height
);
- // Skip if the smallest match already covers >40% of the frame area —
+ if (matches.length === 0) return [];
+
+ // Skip if the smallest match already covers >15% of the frame area —
// that means we only have paragraph-level blocks, not useful highlights.
const smallest = matches[0];
if (smallest.bounds.width * smallest.bounds.height > 0.15) return [];
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
index 8f2c28b3c..25e97c9bc 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -259,7 +259,7 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {
dateChangesRef,
});
- const { zoomLevel, targetZoom, setTargetZoom } = useScrollZoom({
+ const { zoomLevel, targetZoom, setTargetZoom, onContainerWheel } = useScrollZoom({
containerRef,
frames,
currentIndex,
@@ -273,6 +273,11 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {
findNextDevice,
selectedDeviceId,
allDeviceIds,
+ inSearchReviewMode,
+ searchResultIndex,
+ searchResultsCount: searchResults.length,
+ navigateToSearchResultRef,
+ showSearchModal,
});
// Track if user is at "live edge" (viewing newest frame, index 0)
@@ -865,6 +870,7 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {
<div
ref={containerRef}
className="inset-0 flex flex-col text-foreground relative"
+ onWheel={onContainerWheel}
style={{
height: embedded ? "100%" : "100vh",
overscrollBehavior: "none",
@@ -875,7 +881,7 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {
}}
>
{/* Main Image - Full Screen - Should fill entire viewport */}
- <div className={`absolute inset-0 z-10 ${embedded ? "bg-background" : "bg-black"}`}>
+ <div className={`absolute inset-0 z-10 ${embedded ? "bg-background" : "bg-black"}`} onWheel={onContainerWheel}>
{currentFrame ? (
<CurrentFrameTimeline
currentFrame={currentFrame}
@@ -1201,7 +1207,20 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {
{/* Search result navigation indicator — must be outside z-10 image container
so it sits above the z-40 timeline slider and receives clicks */}
{inSearchReviewMode && (
- <div className="absolute bottom-24 left-1/2 -translate-x-1/2 z-[45] flex items-center gap-3 px-4 py-2 rounded-full bg-black/70 backdrop-blur-sm border border-white/10 text-white text-sm shadow-lg">
+ <div
+ className="absolute bottom-24 left-1/2 -translate-x-1/2 z-[45] flex items-center gap-3 px-4 py-2 rounded-full bg-black/70 backdrop-blur-sm border border-white/10 text-white text-sm shadow-lg"
+ onWheel={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ // Scroll/swipe navigates between search results
+ const direction = Math.sign(e.deltaY);
+ if (direction > 0 && searchResultIndex < searchResults.length - 1) {
+ navigateToSearchResult(searchResultIndex + 1);
+ } else if (direction < 0 && searchResultIndex > 0) {
+ navigateToSearchResult(searchResultIndex - 1);
+ }
+ }}
+ >
<span className="text-white/60 truncate max-w-[120px]">&ldquo;{searchQuery}&rdquo;</span>
<button
className="px-1.5 hover:text-white/80 disabled:text-white/30"
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 550c92e22..e344f064a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9172,7 +9172,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.2.81"
+version = "2.2.83"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 3d6de5746..aac692086 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.2.82"
+version = "2.2.83"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
index 7d657faad..6d578ce9b 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -68,6 +68,86 @@ pub fn init_magnify_handler(app: tauri::AppHandle) {
}
info!("magnify gesture handler registered");
+
+ // Register a custom ObjC class that handles scrollWheel forwarding.
+ // WKWebView in standard WebviewWindows (e.g. settings) consumes trackpad
+ // wheel events at the native level — they never reach JavaScript.
+ // We swizzle WKWebView's scrollWheel: to also emit "native-scroll" Tauri
+ // events so the JS timeline code can handle scroll navigation.
+ if Class::get("ScreenpipeScrollInterceptor").is_none() {
+ // Store original IMP so we can call it after emitting
+ static ORIGINAL_SCROLL_WHEEL: std::sync::OnceLock<
+ extern "C" fn(&Object, Sel, *mut Object),
+ > = std::sync::OnceLock::new();
+
+ extern "C" fn swizzled_scroll_wheel(this: &Object, sel: Sel, event: *mut Object) {
+ unsafe {
+ use objc::{msg_send, sel, sel_impl};
+ // Emit Tauri event with scroll data
+ if let Some(app) = MAGNIFY_APP_HANDLE.get() {
+ let delta_y: f64 = msg_send![event, scrollingDeltaY];
+ let delta_x: f64 = msg_send![event, scrollingDeltaX];
+ let modifier_flags: u64 = msg_send![event, modifierFlags];
+ let ctrl_key = (modifier_flags & (1 << 18)) != 0;
+ let meta_key = (modifier_flags & (1 << 20)) != 0;
+
+ let _ = app.emit(
+ "native-scroll",
+ serde_json::json!({
+ "deltaX": delta_x,
+ "deltaY": delta_y,
+ "ctrlKey": ctrl_key,
+ "metaKey": meta_key,
+ }),
+ );
+ }
+ // Call original for overlay (NSPanel) windows so JS wheel
+ // events still fire there. For regular windows (settings),
+ // skip the original to prevent double-processing — the
+ // native-scroll Tauri event handles everything.
+ use objc::class;
+ use tauri_nspanel::cocoa::base::{id as cocoa_id, nil as cocoa_nil};
+ let window: cocoa_id = msg_send![this, window];
+ if window != cocoa_nil {
+ let is_panel: bool = msg_send![window, isKindOfClass: class!(NSPanel)];
+ if is_panel {
+ if let Some(original) = ORIGINAL_SCROLL_WHEEL.get() {
+ original(this, sel, event);
+ }
+ }
+ }
+ }
+ }
+
+ // Swizzle WKWebView scrollWheel:
+ unsafe {
+ use objc::{sel, sel_impl};
+ use objc::runtime::{class_getInstanceMethod, method_getImplementation, method_setImplementation};
+
+ let wk_class = Class::get("WKWebView");
+ if let Some(wk_class) = wk_class {
+ let scroll_sel = sel!(scrollWheel:);
+ let method = class_getInstanceMethod(wk_class as *const _ as *mut _, scroll_sel);
+ if !method.is_null() {
+ let original_imp = method_getImplementation(method as *const _);
+ let original_fn: extern "C" fn(&Object, Sel, *mut Object) =
+ std::mem::transmute(original_imp);
+ let _ = ORIGINAL_SCROLL_WHEEL.set(original_fn);
+
+ let new_imp: objc::runtime::Imp = std::mem::transmute(
+ swizzled_scroll_wheel as extern "C" fn(&Object, Sel, *mut Object),
+ );
+ method_setImplementation(method as *mut _, new_imp);
+ info!("WKWebView scrollWheel: swizzled for native-scroll events");
+ }
+ }
+ }
+
+ // Register dummy class so we don't re-swizzle
+ let superclass = Class::get("NSObject").unwrap();
+ let decl = ClassDecl::new("ScreenpipeScrollInterceptor", superclass).unwrap();
+ decl.register();
+ }
}
#[cfg(not(target_os = "macos"))]
@@ -300,6 +380,21 @@ pub unsafe fn make_nswindow_webview_first_responder(ns_win: tauri_nspanel::cocoa
}
if wk_view != nil {
+ // Disable native scroll on any enclosing NSScrollView wrapping the WKWebView.
+ // Without this, macOS trackpad wheel events are consumed at the AppKit level
+ // and never reach JavaScript — breaking embedded timeline scroll gestures.
+ let scroll_view: id = msg_send![wk_view, enclosingScrollView];
+ if scroll_view != nil {
+ // NSScrollElasticityNone = 1 — prevents bounce scrolling
+ let _: () = msg_send![scroll_view, setVerticalScrollElasticity: 1i64];
+ let _: () = msg_send![scroll_view, setHorizontalScrollElasticity: 1i64];
+ let _: () = msg_send![scroll_view, setHasVerticalScroller: false];
+ let _: () = msg_send![scroll_view, setHasHorizontalScroller: false];
+ }
+
+ // Attach pinch-to-zoom gesture recognizer (same as NSPanel overlay)
+ attach_magnify_gesture_to_view(wk_view);
+
// Set first responder immediately (handles the common case)
let _: () = msg_send![ns_win, makeFirstResponder: wk_view];
@@ -1710,6 +1805,20 @@ impl ShowRewindWindow {
#[cfg(target_os = "macos")]
let builder = builder.hidden_title(true);
let window = builder.build()?;
+
+ // Disable WKWebView's native scroll so wheel events reach JavaScript
+ // (needed for embedded timeline scroll gestures)
+ #[cfg(target_os = "macos")]
+ {
+ if let Ok(ns_win) = window.ns_window() {
+ unsafe {
+ make_nswindow_webview_first_responder(
+ ns_win as tauri_nspanel::cocoa::base::id,
+ );
+ }
+ }
+ }
+
window
}
ShowRewindWindow::Search { query } => {