fmt(js): npm run fix on merge (#81914)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
hermes-seaeye[bot]
2026-08-08 18:10:42 +00:00
committed by GitHub
parent 06d8aa72e1
commit edb27240e2
3 changed files with 11 additions and 52 deletions
+1 -3
View File
@@ -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()
+7 -38
View File
@@ -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()
})
+3 -11
View File
@@ -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) {