π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(desktop): frame a typing step by the window its field is in
Luis Ortiz84e896c98e6a
diff --git a/apps/desktop/scripts/check-pipeline.ts b/apps/desktop/scripts/check-pipeline.tsindex 5807993..b1dfee4 100644--- a/apps/desktop/scripts/check-pipeline.ts+++ b/apps/desktop/scripts/check-pipeline.ts@@ -242,6 +242,49 @@ app.whenReady().then(async () => {detail: `${windowShot?.width ?? 0} px wide for a ${clickedWindow.width} px window`,});+ const findField = { x: clickedWindow.x + 20, y: clickedWindow.y + 10, width: 200, height: 22 };+ const typedInto = new DesktopRecorder(+ () => region,+ (fn) => fn(),+ (request) => {+ framedBy = request;+ return Promise.resolve(null);+ },+ {+ grab: async () => syntheticDisplay,+ settings: () => ({ ...DEFAULT_CAPTURE_SETTINGS, captureMode: 'window' }),+ focused: () =>+ Promise.resolve({+ role: 'textbox',+ name: null,+ textContent: 'ttys002',+ ariaLabel: 'Find',+ altText: null,+ password: false,+ ancestors: [],+ children: [],+ rect: findField,+ }),+ windowAt: (point) =>+ Promise.resolve(+ point.x >= clickedWindow.x &&+ point.x < clickedWindow.x + clickedWindow.width &&+ point.y >= clickedWindow.y &&+ point.y < clickedWindow.y + clickedWindow.height+ ? { ok: true, window: { title: 'Terminal', app: { name: 'Terminal' }, bounds: clickedWindow } }+ : { ok: false, reason: 'unknown', detail: 'no window there' },+ ),+ },+ );+ framedBy = null;+ await typedInto.writeTyping('ttys002');+ const typedShot = (framedBy as CaptureRequest | null)?.image;+ results.push({+ name: 'a typing step frames the window its field is in',+ ok: typedShot?.width === Math.round(clickedWindow.width * display.scaleFactor),+ detail: `${typedShot?.width ?? 0} px wide for a ${clickedWindow.width} px window`,+ });+const control: ScreenElement = {role: 'button',name: 'SaveButton',diff --git a/apps/desktop/src/main/capture/recorder.ts b/apps/desktop/src/main/capture/recorder.tsindex 49a4523..f0a0f1c 100644--- a/apps/desktop/src/main/capture/recorder.ts+++ b/apps/desktop/src/main/capture/recorder.ts@@ -439,15 +439,17 @@ export class DesktopRecorder {frame?: Promise<Frame>,): Promise<void> {const field = seen ? seen.field : await this.focused();- const where = centreOf(field) ?? cursorPoint();+ const centre = centreOf(field);+ const where = centre ?? cursorPoint();const shot = frame ?? this.shoot(where);+ const place = centre ? this.windowAt(centre).catch(() => focusedWindow()) : undefined;if (field?.password) {- await this.write('input', where, Promise.resolve(field), shot);+ await this.write('input', where, Promise.resolve(field), shot, undefined, place);return;}const typed = typedTextFor(field, buffer, seen?.fresh ?? true);if (!typed) return;- await this.write('input', where, Promise.resolve(field), shot, typed);+ await this.write('input', where, Promise.resolve(field), shot, typed, place);}private async write(