fix(overlay): keep forwarding mpv keys after a Yomitan popup closes (#332)

Decide whether the Yomitan popup is open from the popup host in the DOM
instead of the cached yomitanPopupVisible flag, which can lag a close and
kept input.conf keys from reaching mpv.

Keep the imported mpv key list in place while a refresh is in flight, so a
key pressed right after the overlay regains focus is not dropped. A failed
reload still clears the list.

At --log-level debug, log why the overlay kept an mpv-bound key
(config-loading, modal, lookup-popup, interactive-target or
no-imported-bindings) over a validated IPC channel.

Refs #331
This commit is contained in:
sudacode authored and GitHub committed 2026-11-20 18:27:11 -08:00
1 parent 0c1865f4a6
commit 0ae70b4ab2
14 files changed
+227 -23

No files matched your search

+10
View File
@@ -40,10 +40,14 @@ import {
parseSessionActionDispatchRequest,
parseSubtitlePosition,
parseSubsyncManualRunRequest,
parseUnforwardedMpvKeyReport,
parseYoutubePickerResolveRequest,
} from '../../shared/ipc/validators';
import { createLogger } from '../../logger';
import { applyOverlayClickThrough } from './overlay-click-through';
const overlayInputLogger = createLogger('overlay:input');
const { ipcMain } = electron;
export interface IpcServiceDeps {
@@ -640,6 +644,12 @@ export function registerIpcHandlers(deps: IpcServiceDeps, ipc: IpcMainRegistrar
},
);
// Shows, at --log-level debug, why an mpv input.conf key never reached mpv.
ipc.on(IPC_CHANNELS.command.reportUnforwardedMpvKey, (_event: unknown, payload: unknown) => {
const report = parseUnforwardedMpvKeyReport(payload);
if (report) overlayInputLogger.debug('Overlay kept an mpv-bound key', report);
});
ipc.on(IPC_CHANNELS.command.recordYomitanLookup, (_event: unknown, payload: unknown) => {
try {
deps.recordSubtitleMiningContext?.(parseSubtitleMiningContext(payload));