From edb27240e2d99b4ca9587d9ff919b8d04d4560e1 Mon Sep 17 00:00:00 2001 From: "hermes-seaeye[bot]" <307254004+hermes-seaeye[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 18:10:42 +0000 Subject: [PATCH] fmt(js): `npm run fix` on merge (#81914) Co-authored-by: github-actions[bot] --- apps/desktop/electron/main.ts | 4 +- apps/desktop/electron/window-below.test.ts | 45 ++++------------------ apps/desktop/electron/window-below.ts | 14 ++----- 3 files changed, 11 insertions(+), 52 deletions(-) diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 2d2943dbfc..95ffeeed05 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -10351,9 +10351,7 @@ ipcMain.handle('hermes:window:readBelow', async event => { return null } - const titlesAvailable = IS_MAC - ? systemPreferences.getMediaAccessStatus?.('screen') === 'granted' - : true + const titlesAvailable = IS_MAC ? systemPreferences.getMediaAccessStatus?.('screen') === 'granted' : true const [x, y] = win.getPosition() const [width, height] = win.getSize() diff --git a/apps/desktop/electron/window-below.test.ts b/apps/desktop/electron/window-below.test.ts index e07d1a6522..581e71705a 100644 --- a/apps/desktop/electron/window-below.test.ts +++ b/apps/desktop/electron/window-below.test.ts @@ -2,14 +2,7 @@ import { describe, expect, it } from 'vitest' import { type EnumeratedWindow, pickWindowBelow } from './window-below' -const win = ( - pid: number, - x = 0, - y = 0, - width = 800, - height = 600, - app = `app-${pid}` -): EnumeratedWindow => ({ +const win = (pid: number, x = 0, y = 0, width = 800, height = 600, app = `app-${pid}`): EnumeratedWindow => ({ app, bounds: { x, y, width, height }, id: pid * 10, @@ -25,11 +18,7 @@ describe('pickWindowBelow', () => { const chrome = win(1, 120, 120) const spotify = win(2, 130, 130) - const { below, frontmost } = pickWindowBelow( - [win(SELF_PID, 100, 100), chrome, spotify], - SELF_PID, - SELF_BOUNDS - ) + const { below, frontmost } = pickWindowBelow([win(SELF_PID, 100, 100), chrome, spotify], SELF_PID, SELF_BOUNDS) expect(below).toBe(chrome) expect(frontmost).toBe(chrome) @@ -39,11 +28,7 @@ describe('pickWindowBelow', () => { const elsewhere = win(1, 5000, 5000) const covered = win(2, 200, 200) - const { below } = pickWindowBelow( - [win(SELF_PID, 100, 100), elsewhere, covered], - SELF_PID, - SELF_BOUNDS - ) + const { below } = pickWindowBelow([win(SELF_PID, 100, 100), elsewhere, covered], SELF_PID, SELF_BOUNDS) expect(below).toBe(covered) }) @@ -52,11 +37,7 @@ describe('pickWindowBelow', () => { const secondHermesWindow = win(SELF_PID, 150, 150) const target = win(7, 160, 160) - const { below } = pickWindowBelow( - [win(SELF_PID, 100, 100), secondHermesWindow, target], - SELF_PID, - SELF_BOUNDS - ) + const { below } = pickWindowBelow([win(SELF_PID, 100, 100), secondHermesWindow, target], SELF_PID, SELF_BOUNDS) expect(below).toBe(target) }) @@ -64,11 +45,7 @@ describe('pickWindowBelow', () => { it('reports frontmost even when nothing overlaps', () => { const elsewhere = win(1, 5000, 5000) - const { below, frontmost } = pickWindowBelow( - [win(SELF_PID, 100, 100), elsewhere], - SELF_PID, - SELF_BOUNDS - ) + const { below, frontmost } = pickWindowBelow([win(SELF_PID, 100, 100), elsewhere], SELF_PID, SELF_BOUNDS) expect(below).toBeNull() expect(frontmost).toBe(elsewhere) @@ -78,11 +55,7 @@ describe('pickWindowBelow', () => { const inFront = win(3, 110, 110) const behind = win(4, 120, 120) - const { below, frontmost } = pickWindowBelow( - [inFront, win(SELF_PID, 100, 100), behind], - SELF_PID, - SELF_BOUNDS - ) + const { below, frontmost } = pickWindowBelow([inFront, win(SELF_PID, 100, 100), behind], SELF_PID, SELF_BOUNDS) expect(below).toBe(behind) expect(frontmost).toBe(inFront) @@ -106,11 +79,7 @@ describe('pickWindowBelow', () => { it('edge-adjacent bounds do not count as overlap', () => { const adjacent = win(1, 900, 100) // starts exactly at our right edge - const { below } = pickWindowBelow( - [win(SELF_PID, 100, 100), adjacent], - SELF_PID, - SELF_BOUNDS - ) + const { below } = pickWindowBelow([win(SELF_PID, 100, 100), adjacent], SELF_PID, SELF_BOUNDS) expect(below).toBeNull() }) diff --git a/apps/desktop/electron/window-below.ts b/apps/desktop/electron/window-below.ts index 4026b75e32..7c9e0f3ce4 100644 --- a/apps/desktop/electron/window-below.ts +++ b/apps/desktop/electron/window-below.ts @@ -31,10 +31,7 @@ export interface WindowBelowResult { } | null } -const overlaps = ( - a: EnumeratedWindow['bounds'], - b: EnumeratedWindow['bounds'] -): boolean => +const overlaps = (a: EnumeratedWindow['bounds'], b: EnumeratedWindow['bounds']): boolean => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height /** @@ -62,10 +59,7 @@ export function pickWindowBelow( } type GetWindowsModule = { - openWindows: (options?: { - accessibilityPermission?: boolean - screenRecordingPermission?: boolean - }) => Promise< + openWindows: (options?: { accessibilityPermission?: boolean; screenRecordingPermission?: boolean }) => Promise< Array<{ bounds?: { height?: number; width?: number; x?: number; y?: number } id?: number @@ -138,9 +132,7 @@ export async function readWindowBelow( const result: WindowBelowResult = { frontmost: frontmost ? { app: frontmost.app, title: frontmost.title } : null, platform: process.platform, - window: below - ? { app: below.app, bounds: below.bounds, id: below.id, title: below.title } - : null + window: below ? { app: below.app, bounds: below.bounds, id: below.id, title: below.title } : null } if (process.platform === 'darwin' && !titlesAvailable) {