Closed
Conversation
Extract a platform-agnostic MediaController interface from the MPRIS integration so that media key support can be added per-platform without modifying the core TUI code. - mediactl/ package: Controller interface (Update, EmitSeeked, Close), MainLoopRunner interface for controllers that need the main OS thread, and a self-registration registry via init() - MPRIS refactored to implement mediactl.Controller, self-registers via init() with blank import in main.go - TrackInfo and SetPositionMsg moved to shared packages (mediactl and internal/control) so platform code doesn't cross-import - Model uses []mediactl.Controller instead of *mpris.Service, with notifyMediaControllers() and emitSeeked() helpers replacing direct mpris calls - prog.Run() moved to a goroutine with mediactl.RunMainLoop() on the main thread, enabling macOS NSRunLoop (no-op on Linux) - Full macOS CGo scaffold: MPRemoteCommandCenter for receiving media key events, MPNowPlayingInfoCenter for Now Playing info, with change detection to skip redundant CGo calls on the per-second tick - Key handlers upgraded from notifyMPRIS() to notifyAll() so Lua plugins also receive state updates on keyboard actions - Notification hot path uses cached position/duration instead of re-acquiring the speaker lock
Lock the main goroutine to OS thread 1 in init() and defer MediaKeysInit to RunMainLoop so MPRemoteCommandCenter handlers are registered on the correct thread for CFRunLoop delivery.
Closed
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.
Extract a platform-agnostic MediaController interface from the MPRIS
integration so that media key support can be added per-platform without
modifying the core TUI code.
MainLoopRunner interface for controllers that need the main OS thread,
and a self-registration registry via init()
init() with blank import in main.go
internal/control) so platform code doesn't cross-import
notifyMediaControllers() and emitSeeked() helpers replacing direct
mpris calls
main thread, enabling macOS NSRunLoop (no-op on Linux)
key events, MPNowPlayingInfoCenter for Now Playing info, with change
detection to skip redundant CGo calls on the per-second tick
plugins also receive state updates on keyboard actions
re-acquiring the speaker lock
New:
Lock the main goroutine to OS thread 1 in init() and defer
MediaKeysInit to RunMainLoop so MPRemoteCommandCenter handlers
are registered on the correct thread for CFRunLoop delivery.