[macOS] Enable CLI Control & Full "Now Playing" via MPNowPlayingInfoCenter
Problem: No CLI Control for "Now Playing" Metadata on macOS
On macOS, while musikcube correctly responds to media keyboard commands (Play/Pause, Next Track, Previous Track), providing a basic level of system control, it currently lacks the ability to be reliably controlled or queried for track metadata from the command line interface (CLI).
Specifically, the "Now Playing" widget in the macOS Control Center, on the Lock Screen, and general-purpose macOS CLI tools like nowplaying-cli (which query system-level media information) show no information about the currently playing track when musikcube is active. They remain blank or display information from other applications if they were playing.
This behavior strongly indicates that musikcube is not publishing track metadata (such as title, artist, album, duration, etc.) to the MPNowPlayingInfoCenter. The MPNowPlayingInfoCenter is the macOS framework responsible for providing detailed "Now Playing" information to the system UI and, critically, to other applications and tools (including CLI utilities like nowplaying-cli) that wish to read or interact with it.
The working media keys confirm musikcube correctly registers with MPRemoteCommandCenter for receiving commands, but the lack of "Now Playing" metadata suggests it's not publishing information back to the system via MPNowPlayingInfoCenter.
Technical Details:
MPRemoteCommandCenter:musikcubeappears to be correctly interacting with this component of theMediaRemote.frameworkto respond to system media commands (e.g., from physical keyboard keys).MPNowPlayingInfoCenter: It seemsmusikcubedoes not currently populate or update theMPNowPlayingInfoCenter. As a result, the macOS system has no metadata to display for the currently playing track frommusikcube, which in turn prevents other tools from accessing this information.nowplaying-cli: This command-line tool, which queries theMediaRemote.frameworkfor currently playing information, returns empty or no relevant data whenmusikcubeis the active player becausemusikcubeis not providing that data to the system. This blocks CLI-based querying of track information.- Contrast with Linux (
playerctl/ MPRIS): On Linux,musikcubeusers can leverageplayerctl(which uses MPRIS/D-Bus) to get current track information and control playback from the CLI. macOS uses a completely different set of APIs, andplayerctlis not applicable. A similar level of CLI integration is desired for macOS users.
Proposed Solution / Feature Request:
To enable comprehensive CLI control and allow macOS system features to display musikcube's "Now Playing" information, it is requested that musikcube implement full integration with the macOS MediaRemote.framework by populating the MPNowPlayingInfoCenter with the currently playing track's metadata.
This would involve:
- Updating the
nowPlayingInfodictionary within theMPNowPlayingInfoCenterwhenever the track changes or playback state updates. - Optionally, implementing other
MPRemoteCommandCenterhandlers for more granular control (e.g.,seekBackward,seekForward,changePlaybackRate) if not already fully supported.
Benefits:
Implementing this feature would provide several significant improvements for musikcube users on macOS:
- CLI Control & Querying: This is the primary benefit, enabling users to write scripts, create custom shortcuts, or use tools like
nowplaying-clito get current song information (nowplaying-cli get title,get artist) and control playback (nowplaying-cli play,pause,next-track) directly from the terminal. - Native "Now Playing" Widget: Display of track title, artist, and album in the macOS Control Center, Notification Center, and Lock Screen.
- Touch Bar Integration: Correct track information and controls on MacBooks with a Touch Bar.
- Enhanced User Experience: A more seamless and integrated experience within the macOS ecosystem, bringing
musikcube's CLI capabilities closer to what's available on Linux.
Environment:
- macOS Version:
15.5 - musikcube Version:
3.0.4