Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

Merge branch 'main' into feature/shortcuts-configuration

Fabien Laurence57fdad0646ee
diff --cc electron/ipc/handlers.ts
index caa82ca49,24a63a11c..cec3ed90d
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@@ -4,9 -4,59 +4,61 @@@ import fs from 'node:fs/promises
import path from 'node:path'
import { RECORDINGS_DIR } from '../main'
+const SHORTCUTS_FILE = path.join(app.getPath('userData'), 'shortcuts.json')
+
let selectedSource: any = null
+ let currentVideoPath: string | null = null
+
+ const CURSOR_TELEMETRY_VERSION = 1
+ const CURSOR_SAMPLE_INTERVAL_MS = 100
+ const MAX_CURSOR_SAMPLES = 60 * 60 * 10 // 1 hour @ 10Hz
+
+ interface CursorTelemetryPoint {
+ timeMs: number
+ cx: number
+ cy: number
+ }
+
+ let cursorCaptureInterval: NodeJS.Timeout | null = null
+ let cursorCaptureStartTimeMs = 0
+ let activeCursorSamples: CursorTelemetryPoint[] = []
+ let pendingCursorSamples: CursorTelemetryPoint[] = []
+
+ function clamp(value: number, min: number, max: number) {
+ return Math.min(max, Math.max(min, value))
+ }
+
+ function stopCursorCapture() {
+ if (cursorCaptureInterval) {
+ clearInterval(cursorCaptureInterval)
+ cursorCaptureInterval = null
+ }
+ }
+
+ function sampleCursorPoint() {
+ const cursor = screen.getCursorScreenPoint()
+ const sourceDisplayId = Number(selectedSource?.display_id)
+ const sourceDisplay = Number.isFinite(sourceDisplayId)
+ ? screen.getAllDisplays().find((display) => display.id === sourceDisplayId) ?? null
+ : null
+ const display = sourceDisplay ?? screen.getDisplayNearestPoint(cursor)
+ const bounds = display.bounds
+ const width = Math.max(1, bounds.width)
+ const height = Math.max(1, bounds.height)
+
+ const cx = clamp((cursor.x - bounds.x) / width, 0, 1)
+ const cy = clamp((cursor.y - bounds.y) / height, 0, 1)
+
+ activeCursorSamples.push({
+ timeMs: Math.max(0, Date.now() - cursorCaptureStartTimeMs),
+ cx,
+ cy,
+ })
+
+ if (activeCursorSamples.length > MAX_CURSOR_SAMPLES) {
+ activeCursorSamples.shift()
+ }
+ }
export function registerIpcHandlers(
createEditorWindow: () => void,
diff --cc src/components/video-editor/timeline/TimelineEditor.tsx
index dc2b2bda3,9b153337e..2d0ced8ee
--- a/src/components/video-editor/timeline/TimelineEditor.tsx
+++ b/src/components/video-editor/timeline/TimelineEditor.tsx
@@@ -20,8 -20,7 +20,9 @@@ import
import { type AspectRatio, getAspectRatioLabel, ASPECT_RATIOS } from "@/utils/aspectRatioUtils";
import { formatShortcut } from "@/utils/platformUtils";
import { TutorialHelp } from "../TutorialHelp";
+import { useShortcuts } from "@/contexts/ShortcutsContext";
+import { matchesShortcut } from "@/lib/shortcuts";
+ import { detectZoomDwellCandidates, normalizeCursorTelemetry } from "./zoomSuggestionUtils";
const ZOOM_ROW_ID = "row-zoom";
const TRIM_ROW_ID = "row-trim";