mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
fix: suppress mpv primary subtitles when visible overlay is enabled
This commit is contained in:
@@ -131,7 +131,7 @@ test('dispatchMpvProtocolMessage enforces sub-visibility hidden when overlay sup
|
||||
);
|
||||
|
||||
assert.deepEqual(state.commands.pop(), {
|
||||
command: ['set_property', 'sub-visibility', false],
|
||||
command: ['set_property', 'sub-visibility', 'no'],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -219,11 +219,10 @@ export async function dispatchMpvProtocolMessage(
|
||||
});
|
||||
} else if (msg.name === 'sub-visibility') {
|
||||
if (
|
||||
deps.shouldBindVisibleOverlayToMpvSubVisibility?.() &&
|
||||
deps.isVisibleOverlayVisible() &&
|
||||
asBoolean(msg.data, false)
|
||||
) {
|
||||
deps.sendCommand({ command: ['set_property', 'sub-visibility', false] });
|
||||
deps.sendCommand({ command: ['set_property', 'sub-visibility', 'no'] });
|
||||
}
|
||||
} else if (msg.name === 'sub-use-margins') {
|
||||
deps.emitSubtitleMetricsChange({
|
||||
|
||||
@@ -473,8 +473,13 @@ export class MpvIpcClient implements MpvClient {
|
||||
}
|
||||
|
||||
setSubVisibility(visible: boolean): void {
|
||||
const value = visible ? 'yes' : 'no';
|
||||
this.send({
|
||||
command: ['set_property', 'sub-visibility', visible],
|
||||
command: ['set_property', 'sub-visibility', value],
|
||||
});
|
||||
// Compatibility write for mpv command aliases across setups.
|
||||
this.send({
|
||||
command: ['set', 'sub-visibility', value],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -758,10 +758,7 @@ const restoreOverlayMpvSubtitles = createRestoreOverlayMpvSubtitlesHandler({
|
||||
});
|
||||
|
||||
function shouldSuppressMpvSubtitlesForOverlay(): boolean {
|
||||
return (
|
||||
overlayManager.getVisibleOverlayVisible() &&
|
||||
configDerivedRuntime.shouldBindVisibleOverlayToMpvSubVisibility()
|
||||
);
|
||||
return overlayManager.getVisibleOverlayVisible();
|
||||
}
|
||||
|
||||
function syncOverlayMpvSubtitleSuppression(): void {
|
||||
|
||||
@@ -25,6 +25,7 @@ function parseSubVisibility(value: unknown): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
export function createEnsureOverlayMpvSubtitlesHiddenHandler(deps: {
|
||||
getMpvClient: () => MpvVisibilityClient | null;
|
||||
getSavedSubVisibility: () => boolean | null;
|
||||
|
||||
Reference in New Issue
Block a user