INNER CODE UNIT · TypeScript
resolveWindowBounds
elie222/inbox-zero · apps/desktop/src/main.ts:493
function resolveWindowBounds(
stored?: DesktopWindowBounds,
): DesktopWindowBounds | undefined {
if (stored) {
return fitWindowBoundsToWorkArea(
stored,
screen.getDisplayMatching(stored).workArea,
);
}
const source = lastFocused && !lastFocused.isDestroyed() ? lastFocused : null;
if (!source) return;
const bounds = source.getNormalBounds();
return fitWindowBoundsToWorkArea(
{ ...bounds, x: bounds.x + 28, y: bounds.y + 28 },
screen.getDisplayMatching(source.getBounds()).workArea,
);
}