fix(overlay): Linux X11/XWayland stacking, stale pause state, multi-copy selector (#101)

This commit is contained in:
2026-05-31 20:59:18 -07:00
committed by GitHub
parent b46b8dfa41
commit e1ea464bc9
103 changed files with 6314 additions and 353 deletions
+39
View File
@@ -0,0 +1,39 @@
type PlaybackPausedMpvClient = {
connected?: boolean;
requestProperty?: (name: string) => Promise<unknown>;
};
function coercePlaybackPaused(value: unknown): boolean | null {
if (typeof value === 'boolean') return value;
if (typeof value === 'number') return value !== 0;
if (typeof value === 'string') {
const normalized = value.trim().toLowerCase();
if (normalized === 'no' || normalized === 'false' || normalized === '0') return false;
if (normalized === 'yes' || normalized === 'true' || normalized === '1') return true;
}
return null;
}
export async function resolveFreshPlaybackPaused(deps: {
getCachedPlaybackPaused: () => boolean | null;
getMpvClient: () => PlaybackPausedMpvClient | null;
}): Promise<boolean | null> {
const cachedPaused = deps.getCachedPlaybackPaused();
if (cachedPaused === true) {
return true;
}
const client = deps.getMpvClient();
if (client?.connected === true && typeof client.requestProperty === 'function') {
try {
const livePaused = coercePlaybackPaused(await client.requestProperty('pause'));
if (livePaused !== null) {
return livePaused;
}
} catch {
// Avoid trusting a stale cached "playing" state for hover auto-pause.
}
}
return cachedPaused === false ? null : cachedPaused;
}