fix(overlay): correct Hyprland fullscreen overlay alignment on Linux (#107)

This commit is contained in:
2026-06-01 02:12:16 -07:00
committed by GitHub
parent f1e260e996
commit 76f99e6518
15 changed files with 501 additions and 23 deletions
+35 -1
View File
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { ensureOverlayWindowLevel } from './overlay-window';
import { ensureOverlayWindowLevel, updateOverlayWindowBounds } from './overlay-window';
import {
handleOverlayWindowBeforeInputEvent,
handleOverlayWindowBlurred,
@@ -288,3 +288,37 @@ test('ensureOverlayWindowLevel promotes Linux overlay above fullscreen mpv witho
'move-top',
]);
});
test('updateOverlayWindowBounds aligns Linux overlay content bounds to mpv geometry', () => {
const originalPlatformDescriptor = Object.getOwnPropertyDescriptor(process, 'platform');
const originalHyprlandSignature = process.env.HYPRLAND_INSTANCE_SIGNATURE;
Object.defineProperty(process, 'platform', {
configurable: true,
value: 'linux',
});
delete process.env.HYPRLAND_INSTANCE_SIGNATURE;
const calls: Array<{ x: number; y: number; width: number; height: number }> = [];
try {
updateOverlayWindowBounds({ x: 0, y: 0, width: 3440, height: 1440 }, {
isDestroyed: () => false,
getTitle: () => 'SubMiner Overlay',
getBounds: () => ({ x: 0, y: 0, width: 3440, height: 1440 }),
getContentBounds: () => ({ x: 0, y: 14, width: 3440, height: 1426 }),
setBounds: (bounds: { x: number; y: number; width: number; height: number }) => {
calls.push(bounds);
},
} as never);
} finally {
if (originalPlatformDescriptor) {
Object.defineProperty(process, 'platform', originalPlatformDescriptor);
}
if (originalHyprlandSignature === undefined) {
delete process.env.HYPRLAND_INSTANCE_SIGNATURE;
} else {
process.env.HYPRLAND_INSTANCE_SIGNATURE = originalHyprlandSignature;
}
}
assert.deepEqual(calls, [{ x: 0, y: -14, width: 3440, height: 1454 }]);
});