Skip to content

Windows: Now Playing over SMTC, with Mochi dancing along - #194

Closed
marlonayaladev wants to merge 1 commit into
Louis-CFM:mainfrom
marlonayaladev:windows-sm-tc
Closed

marlonayaladev wants to merge 1 commit into
Louis-CFM:mainfrom
marlonayaladev:windows-sm-tc

Conversation

@marlonayaladev

Copy link
Copy Markdown

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.rs polls SMTC once every 2 s and emits the media event 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.ts renders the row: title, artist, and Previous / Play-Pause / Next, wired to TryPlayAsync / TryTogglePlayPauseAsync / TrySkipNextAsync.
  • mochi/engine.ts ramps a danceLevel in over 0.3 s and out over 0.5 s — the same ramps as the macOS build — driving Mochi's tilt and bounce.
  • Settings gains a Now playing toggle (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 in main.

Verification

  • npx tsc --noEmit — clean
  • cargo check -p coucou — clean, no warnings

Note

src-tauri/src/media.rs is 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.

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.
@marlonayaladev marlonayaladev closed this by deleting the head repository Oct 4, 2026
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.

1 participant