mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-28 04:19:27 -07:00
fix: refresh overlay on Hyprland fullscreen
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
isHyprlandGeometryEvent,
|
||||
parseHyprctlClients,
|
||||
resolveHyprlandWindowGeometry,
|
||||
selectHyprlandMpvWindow,
|
||||
type HyprlandClient,
|
||||
type HyprlandMonitor,
|
||||
} from './hyprland-tracker';
|
||||
|
||||
function makeClient(overrides: Partial<HyprlandClient> = {}): HyprlandClient {
|
||||
@@ -19,6 +22,17 @@ function makeClient(overrides: Partial<HyprlandClient> = {}): HyprlandClient {
|
||||
};
|
||||
}
|
||||
|
||||
function makeMonitor(overrides: Partial<HyprlandMonitor> = {}): HyprlandMonitor {
|
||||
return {
|
||||
id: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
test('selectHyprlandMpvWindow ignores hidden and unmapped mpv clients', () => {
|
||||
const selected = selectHyprlandMpvWindow(
|
||||
[
|
||||
@@ -106,3 +120,32 @@ test('parseHyprctlClients tolerates non-json prefix output', () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('isHyprlandGeometryEvent treats fullscreenv2 as a geometry-changing event', () => {
|
||||
assert.equal(isHyprlandGeometryEvent('fullscreenv2'), true);
|
||||
assert.equal(isHyprlandGeometryEvent('workspacev2'), true);
|
||||
assert.equal(isHyprlandGeometryEvent('activewindowv2'), false);
|
||||
});
|
||||
|
||||
test('resolveHyprlandWindowGeometry uses monitor bounds for fullscreen clients', () => {
|
||||
const geometry = resolveHyprlandWindowGeometry(
|
||||
makeClient({
|
||||
at: [60, 80],
|
||||
size: [1280, 720],
|
||||
monitor: 1,
|
||||
fullscreen: 2,
|
||||
fullscreenClient: 2,
|
||||
}),
|
||||
[
|
||||
makeMonitor({ id: 0, x: 0, y: 0, width: 1920, height: 1080 }),
|
||||
makeMonitor({ id: 1, x: 1920, y: 0, width: 2560, height: 1440 }),
|
||||
],
|
||||
);
|
||||
|
||||
assert.deepEqual(geometry, {
|
||||
x: 1920,
|
||||
y: 0,
|
||||
width: 2560,
|
||||
height: 1440,
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user