diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index 772e5ff9..00f0da6e 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -1224,6 +1224,7 @@ let isCursorCaptureActive = false let interactionCaptureCleanup: (() => void) | null = null let hasLoggedInteractionHookFailure = false let lastLeftClick: { timeMs: number; cx: number; cy: number } | null = null +let linuxCursorScreenPoint: { x: number; y: number; updatedAt: number } | null = null let selectedWindowBounds: WindowBounds | null = null let windowBoundsCaptureInterval: NodeJS.Timeout | null = null @@ -1318,21 +1319,26 @@ async function resolveMacWindowBounds(source: SelectedSource): Promise { + if (process.platform !== 'linux' || !isCursorCaptureActive) { + return + } + + const point = getHookCursorScreenPoint(event) + if (!point) { + return + } + + linuxCursorScreenPoint = { x: point.x, y: point.y, updatedAt: Date.now() } + } + hook.on('mousedown', onMouseDown) hook.on('mouseup', onMouseUp) + hook.on('mousemove', onMouseMove) hook.start() @@ -1522,9 +1561,11 @@ async function startInteractionCapture() { if (typeof hook.off === 'function') { hook.off('mousedown', onMouseDown) hook.off('mouseup', onMouseUp) + hook.off('mousemove', onMouseMove) } else if (typeof hook.removeListener === 'function') { hook.removeListener('mousedown', onMouseDown) hook.removeListener('mouseup', onMouseUp) + hook.removeListener('mousemove', onMouseMove) } } catch { // ignore listener cleanup errors @@ -2229,6 +2270,7 @@ export function registerIpcHandlers( activeCursorSamples = [] pendingCursorSamples = [] cursorCaptureStartTimeMs = Date.now() + linuxCursorScreenPoint = null lastLeftClick = null sampleCursorPoint() cursorCaptureInterval = setInterval(sampleCursorPoint, CURSOR_SAMPLE_INTERVAL_MS) @@ -2239,6 +2281,7 @@ export function registerIpcHandlers( stopInteractionCapture() stopWindowBoundsCapture() stopNativeCursorMonitor() + linuxCursorScreenPoint = null snapshotCursorTelemetryForPersistence() activeCursorSamples = [] }