Files
SubMiner/backlog/tasks/task-295 - Add-primary-subtitle-visibility-keybinding.md

3.5 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, priority
id title status assignee created_date updated_date labels dependencies priority
TASK-295 Add primary subtitle visibility keybinding Done
Codex
2026-04-25 23:09 2026-04-25 23:45
renderer
keybindings
subtitles
medium

Description

Add a v keybinding that overrides mpv's default v subtitle visibility toggle and instead toggles SubMiner's primary subtitle bar visibility on and off. Secondary subtitle hover behavior is out of scope.

Acceptance Criteria

  • #1 Pressing v toggles the primary subtitle bar from visible to hidden.
  • #2 Pressing v again restores the primary subtitle bar visibility.
  • #3 The keybinding does not add or change secondary subtitle hover behavior.
  • #4 Relevant automated coverage verifies the toggle behavior.
  • #5 Pressing v in the mpv/plugin keybinding path also toggles the primary subtitle bar visibility instead of mpv native subtitle visibility.

Implementation Plan

  1. Inspect existing renderer keybinding and subtitle bar visibility code, including current local edits in touched files.
  2. Add a focused failing test for v toggling primary subtitle bar visibility without changing secondary hover behavior.
  3. Implement the minimal renderer/keybinding change.
  4. Run targeted tests and update acceptance criteria/final notes.

Implementation Notes

Implemented renderer-local KeyV handling before session/mpv binding dispatch so mpv sub-visibility is not touched. Visibility state is stored in renderer state and applied via primary-sub-hidden class on the primary subtitle container.

Scope updated after user clarified the toggle must work when focus is in mpv as well as in the overlay renderer. Added a forced mpv plugin binding for v that runs --toggle-primary-subtitle-bar, then broadcasts a renderer IPC toggle event and reuses the same primary subtitle bar toggle path.

Final Summary

Summary:

  • Added a renderer-local v key handler that toggles primary subtitle bar visibility by adding/removing primary-sub-hidden on the primary subtitle container.
  • Added renderer state for the toggle so repeated presses restore the bar without issuing mpv sub-visibility commands.
  • Added a forced mpv plugin v binding that invokes --toggle-primary-subtitle-bar and broadcasts the same renderer toggle event.
  • Added CSS for the hidden primary subtitle bar state and regression coverage for both overlay and mpv/plugin entry points.

Tests:

  • bun test src/renderer/handlers/keyboard.test.ts --test-name-pattern "primary subtitle visibility key"
  • bun test src/cli/args.test.ts --test-name-pattern "session action"
  • bun test src/core/services/cli-command.test.ts --test-name-pattern "visibility and utility"
  • bun test src/cli/args.test.ts src/cli/help.test.ts src/core/services/cli-command.test.ts src/main/runtime/cli-command-context.test.ts src/main/runtime/cli-command-context-deps.test.ts src/main/runtime/cli-command-context-main-deps.test.ts src/main/runtime/cli-command-context-factory.test.ts src/main/runtime/composers/cli-startup-composer.test.ts src/main/runtime/first-run-setup-service.test.ts
  • lua scripts/test-plugin-start-gate.lua && lua scripts/test-plugin-lua-compat.lua
  • bun run typecheck
  • bun run test:fast