Skip to content

feat: add subtitle toggle hotkey#961

Open
schembriaiden wants to merge 6 commits intoDonutWare:developfrom
schembriaiden:feat/subtitle-shortcut
Open

feat: add subtitle toggle hotkey#961
schembriaiden wants to merge 6 commits intoDonutWare:developfrom
schembriaiden:feat/subtitle-shortcut

Conversation

@schembriaiden
Copy link
Copy Markdown
Contributor

@schembriaiden schembriaiden commented Apr 17, 2026

Pull Request Description

This pull request introduces a new "toggle subtitles" hotkey feature to the video player, allowing users to quickly enable or disable subtitles using a keyboard shortcut. The implementation includes localization, hotkey mapping, and logic for toggling subtitles, including handling multiple subtitle tracks and remembering the user's last selection.

New Subtitle Toggle Feature:

  • Added a new toggleSubtitles hotkey to the VideoHotKeys enum, mapped by default to the "T" key (LogicalKeyboardKey.keyT).
  • Implemented the _toggleSubtitles method in _DesktopControlsState to handle toggling subtitles on/off, supporting both single and multiple subtitle tracks and remembering the last selected subtitle.
  • Integrated the new hotkey into the video player controls so pressing the hotkey triggers subtitle toggling.

Localization:

  • Added the toggleSubtitles string to the English localization file (app_en.arb) for display in the UI and settings.
  • Updated the VideoHotKeys label mapping to include the new toggleSubtitles key for proper display in settings menus.

Codebase Maintenance:

  • Added the necessary import for media_streams_model.dart to support subtitle toggling logic.
  • Introduced a _lastSelectedSubtitleIndex state variable to remember the user's last subtitle choice across toggles.

Logic is as follow:

Press toggle:

  1. If there is only 1 type of subtitle it just uses it
  2. If there is multiple subtitle types:
    1. First time it asks you to select the one you want
    2. After it keeps using the same one.

Issue Being Fixed

Resolves #957

Screenshots / Recordings

Tested On

  • Android
  • Android TV
  • iOS
  • Linux
  • Windows
  • macOS
  • Web

Checklist

  • If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
  • Check that any changes are related to the issue at hand.

Comment thread lib/screens/video_player/video_player_controls.dart
Comment thread lib/models/settings/video_player_settings.dart
Copy link
Copy Markdown
Collaborator

@PartyDonut PartyDonut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to not work entirely like expected.

When I have a subtitle selected it still opens the subselection.
After then selecting that subtitle it toggles on/off fine.

When off is the initial selection and I press the toggle it shows subselection. After selecting something toggling works like expected.

But after then selecting a different subtitle toggling still toggles between the initial selection and off. Not the new selection and off.

@schembriaiden
Copy link
Copy Markdown
Contributor Author

All the cases you mentioned should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants