Windows: Now Playing over SMTC, with Mochi dancing along - #194
Closed
marlonayaladev wants to merge 1 commit into
Closed
marlonayaladev wants to merge 1 commit into
marlonayaladev wants to merge 1 commit into
Conversation
The Mac build reads Apple Music through NSAppleScript; Windows has no scripting bridge to any player, so this goes through the System Media Transport Controls session manager instead. It is player-agnostic: Spotify, VLC, browsers and Apple Music's own preview all publish a session there. - media.rs polls SMTC every 2s and emits a media event only when something actually changes; an idle machine stays silent. - A Now Playing row sits at the top of the overview card with previous / play-pause / next transport buttons. - Mochi sways and bounces along while music is playing, on the same ramps as the macOS build. - A Now playing toggle in Settings turns the whole thing off.
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.
What
Windows now shows whatever is playing on the machine — title, artist and transport buttons — as a row at the top of the overview card, and Mochi sways and bounces along while it plays.
Why
The Mac build reads Apple Music through
NSAppleScript. Windows has no scripting bridge to any player, so this goes through the System Media Transport Controls session manager instead, which is player-agnostic: Spotify, VLC, browsers and Apple Music's own preview all publish a session there.How it works
src-tauri/src/media.rspolls SMTC once every 2 s and emits themediaevent only when something actually changes, so an idle machine stays silent. An empty payload is emitted when the setting is turned off, to clear the card.src/views/music.tsrenders the row: title, artist, and Previous / Play-Pause / Next, wired toTryPlayAsync/TryTogglePlayPauseAsync/TrySkipNextAsync.mochi/engine.tsramps adanceLevelin over 0.3 s and out over 0.5 s — the same ramps as the macOS build — driving Mochi's tilt and bounce.musicEnabled), defaulting to on. Turning it off stops the poller and hides the row.Scope
The media integration and nothing else: 14 files under
windows/, all of them additions. The notch geometry, the compact integrations grid, the Spanish translation and the chat/provider work are all left exactly as they are inmain.Verification
npx tsc --noEmit— cleancargo check -p coucou— clean, no warningsNote
src-tauri/src/media.rsis also created by #83, #80 and #79. Whoever merges first wins and the rest need a rebase — happy to rebase on top of any of them.