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(), {
|
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') {
|
} else if (msg.name === 'sub-visibility') {
|
||||||
if (
|
if (
|
||||||
deps.shouldBindVisibleOverlayToMpvSubVisibility?.() &&
|
|
||||||
deps.isVisibleOverlayVisible() &&
|
deps.isVisibleOverlayVisible() &&
|
||||||
asBoolean(msg.data, false)
|
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') {
|
} else if (msg.name === 'sub-use-margins') {
|
||||||
deps.emitSubtitleMetricsChange({
|
deps.emitSubtitleMetricsChange({
|
||||||
|
|||||||
@@ -473,8 +473,13 @@ export class MpvIpcClient implements MpvClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSubVisibility(visible: boolean): void {
|
setSubVisibility(visible: boolean): void {
|
||||||
|
const value = visible ? 'yes' : 'no';
|
||||||
this.send({
|
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 {
|
function shouldSuppressMpvSubtitlesForOverlay(): boolean {
|
||||||
return (
|
return overlayManager.getVisibleOverlayVisible();
|
||||||
overlayManager.getVisibleOverlayVisible() &&
|
|
||||||
configDerivedRuntime.shouldBindVisibleOverlayToMpvSubVisibility()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncOverlayMpvSubtitleSuppression(): void {
|
function syncOverlayMpvSubtitleSuppression(): void {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ function parseSubVisibility(value: unknown): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function createEnsureOverlayMpvSubtitlesHiddenHandler(deps: {
|
export function createEnsureOverlayMpvSubtitlesHiddenHandler(deps: {
|
||||||
getMpvClient: () => MpvVisibilityClient | null;
|
getMpvClient: () => MpvVisibilityClient | null;
|
||||||
getSavedSubVisibility: () => boolean | null;
|
getSavedSubVisibility: () => boolean | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user