Add persistent play/pause button to navbar for TTS#1661
Open
4rdii wants to merge 1 commit intojohnfactotum:gtk4from
Open
Add persistent play/pause button to navbar for TTS#16614rdii wants to merge 1 commit intojohnfactotum:gtk4from
4rdii wants to merge 1 commit intojohnfactotum:gtk4from
Conversation
The Narration (headphones) button opens a popover containing the TTS play/pause/skip controls and the Speed/Pitch scales. The popover closes on outside click, so once the user starts narration and returns focus to the reading surface, there is no visible control for pausing or resuming — the user has to re-click the headphones button, wait for the popover, click the play-button toggle, and then click away again. For a reading-along-with-TTS flow, this is painful. This change adds a small GtkButton (id: tts-quick-play) to the main navbar, directly before the existing headphones GtkMenuButton. Its clicked signal delegates to tts_box.play(), and its icon-name is kept in sync with the popover's play button via a GObject property binding (SYNC_CREATE), so: - Clicking the navbar button starts TTS (or pauses/resumes it). - Clicking the in-popover play button also updates the navbar button's icon. - Both buttons always show the same media-playback-start-symbolic or media-playback-pause-symbolic state. The navbar button is always visible, adds no new strings besides "Play/Pause Narration" (translatable), and requires one small addition to FoliateTTSBox — a public `playButton` getter so the navbar can reference the internal child without reaching into private state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a small GtkButton to the main navbar, directly before the existing headphones (Narration) GtkMenuButton, that lets the user start/pause/resume TTS without having to re-open the popover each time.
Motivation
Today, starting narration looks like this:
For a "read along while TTS narrates" flow, this is three round-trips just to toggle pause. Adding a persistent button in the toolbar makes it a single click.
How it works
GtkButtonwith idtts-quick-play,image-buttonstyle,media-playback-start-symbolicinitial icon, and tooltip "Play/Pause Narration". Placed as a sibling of the existing headphonesGtkMenuButton.this._tts_quick_play.connect('clicked', () => this.tts_box.play())— delegates to the sameplay()method that the in-popover button calls.bind_property('icon-name', ..., SYNC_CREATE)) mirrors the popover play button'sicon-nameonto the navbar button. Whichever button the user clicks, both icons flip in lockstep betweenmedia-playback-start-symbolicandmedia-playback-pause-symbolic.FoliateTTSBox: a publicplayButtongetter, sonavbar.jscan reference the internal child without reaching into private state.Non-goals
SpaceorCtrl+Pbinding would be nice but is orthogonal and deserves its own discussion for conflict handling with the reader's existing shortcuts.Visual impact
One additional button in the toolbar, same size as the other image buttons, so the toolbar widens by roughly one icon's worth. Icon and tooltip are standard GTK symbolic.
Test plan
media-playback-start-symbolic.media-playback-pause-symbolic.🤖 Generated with Claude Code