mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-07 13:08:54 -07:00
fix(overlay): correct Hyprland fullscreen overlay alignment on Linux (#107)
This commit is contained in:
@@ -3,12 +3,25 @@ import type { WindowGeometry } from '../../types';
|
||||
type OverlayBoundsWindow = {
|
||||
isDestroyed: () => boolean;
|
||||
getBounds: () => WindowGeometry;
|
||||
getContentBounds?: () => WindowGeometry;
|
||||
};
|
||||
|
||||
function sameGeometry(a: WindowGeometry | null | undefined, b: WindowGeometry): boolean {
|
||||
return a?.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
||||
}
|
||||
|
||||
function getWindowAlignmentBounds(window: OverlayBoundsWindow): WindowGeometry | null {
|
||||
try {
|
||||
return window.getContentBounds?.() ?? window.getBounds();
|
||||
} catch {
|
||||
try {
|
||||
return window.getBounds();
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function hasLiveOverlayWindowBoundsMismatch(
|
||||
windows: Array<OverlayBoundsWindow | null | undefined>,
|
||||
geometry: WindowGeometry,
|
||||
@@ -17,7 +30,7 @@ export function hasLiveOverlayWindowBoundsMismatch(
|
||||
if (!window || window.isDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
return !sameGeometry(window.getBounds(), geometry);
|
||||
return !sameGeometry(getWindowAlignmentBounds(window), geometry);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user