Repository navigation
Windows: the Spotify pill through the system's media session, and an opt-in new-song announcement - #374
Closed
shakibbinkabir wants to merge 2 commits into
Closed
Windows: the Spotify pill through the system's media session, and an opt-in new-song announcement#374shakibbinkabir wants to merge 2 commits into
shakibbinkabir wants to merge 2 commits into
Conversation
The Linux pill reads Spotify over MPRIS. Windows has System Media Transport Controls: every player reports its track to the system and takes play, pause, next… through it. The pill now reads Spotify's session there, behind the same five functions the Linux client implements, so the page is the Linux one. - No polling: one thread sleeps on a channel while the pill is declared, and Windows wakes it when a session comes or goes or Spotify's changes. Spotify updates its timeline as it plays; only a jump counts as news, so a playing track sends the island nothing. - Spotify only: the session is picked by its app id (the Store build and the one from spotify.com). A browser playing a video is not shown. - The cover comes with the session, so nothing is fetched. - The session has no volume: the slider moves Spotify's level in the Windows volume mixer. - Shuffle and repeat are left out of the card on Windows. Spotify answers that it changed them and changes nothing, so `modes` in the state tells the card. - The session carries no Spotify URI: tracks get a `spotify:local:` id, so there is no page to open and an ad is not recognised as one. - "Open Spotify" follows a `spotify:` link, which starts it or brings it forward; without Spotify, its download page. The pill is now offered on both systems (`support: "yes"`), and the Linux-only support kind this pill had introduced goes away with its last user. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
When Spotify moves on to another song, the island opens on Spotify's card for three seconds and folds back, and the pill that was in front gets its place again. A light in Mochi's colour breathes behind him, the cover glows and a sheen crosses it, so it reads as news and not as an island that opened by accident. No sound: music is playing. The idea and its look are Edurique's, from Louis-CFM#83. It is rebuilt here on the card and the state machine as they are today, and nothing of the card changes outside those three seconds. - Off by default (Settings → Integrations → Spotify → Announce new songs). The island never opens on its own for news that asks nothing, and the Mac does not do this, so it is something to turn on. - A new song is one that starts after another: not the first heard since Spotify started, not the same one going on after a pause or a seek, never an ad. Windows names a track before it says it plays; it is announced once it does. - Never over an island that is open, under the mouse, pinned or waiting for an answer. The mouse coming, a key or an alert makes it an open island like any other: the auto-close delay applies again, the usual sounds come back, and the front stays where the user sees it. - The state machine gains `glance(seconds)`: open, and fold after its own delay instead of the auto-close preference. It is the hover-open's short countdown with another length, and ends the same way (`userInteracted`). - The light takes the colour of the pill's Mochi, so a colour picked in Settings → Active pills is the light's too. - Songs skipped through carry one announcement on, and the front still goes back to the pill that had it before the first. Co-authored-by: Edurique <225876024+Edurique@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
shakibbinkabir
force-pushed
the
spotify-windows
branch
from
October 9, 2026 00:00
4751747 to
e428a68
Compare
PythonTilk
added a commit
to PythonTilk/coucou
that referenced
this pull request
Oct 9, 2026
…opt-in new-song announcement Taken from shakibbinkabir:spotify-windows while it is still open upstream. The pill reads Spotify through the system's media session; announcing a new song is off by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PythonTilk
added a commit
to PythonTilk/coucou
that referenced
this pull request
Oct 9, 2026
…(opt-in) Taken from shakibbinkabir's branch while it is still open upstream; its first two commits are Louis-CFM#374, already here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 2026
Owner
|
Thank you for this! Several PRs added the Spotify pill on Windows through the system media session; #493 was merged (in #661) as the one to keep, so I'm closing this one as a duplicate. Your opt-in new-song announcement isn't in #493: feel free to send it as a small follow-up PR on top of it. Generated by Claude Code |
PythonTilk
added a commit
to PythonTilk/coucou
that referenced
this pull request
Oct 18, 2026
…s on top From upstream: the Coucou window with Flow dictation, the Notetaker and « OK Coucou », its Spotify pill, and settings as pages in that window. Taken over this build's own versions: « OK Coucou » replaces the hotkey voice (removed just before), upstream's Spotify replaces Louis-CFM#374 and Louis-CFM#412 (the beat dance goes with them), and the settings pages replace the folding groups. Kept and moved onto the pages: Updates (General), the chat provider picker (Chat), Phone alerts and Mail (Integrations). Co-Authored-By: Claude Opus 5.5 <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.
#372 brought the Spotify pill to Linux and left Windows with "no music source yet". This adds that source, and, as a separate commit, an opt-in announcement of each new song. Part of #322, for Spotify only, like the pill on the Mac and on Linux.
ba0daa7e428a68Take 1 alone if 2 is not for Coucou: it is a behaviour the Mac does not have, which is why it is its own commit and off unless turned on.
1. The Spotify pill on Windows
(The teal VS Code Mochi is my own colour setting, not part of this.)
How it reads Spotify
coucou-spotify) sleeps on a channel. Windows wakes it forSessionsChanged(Spotify starting or quitting) and for the session'sMediaPropertiesChanged,PlaybackInfoChangedandTimelinePropertiesChanged. Undeclaring the pill sends itStopand removes the handlers.is_news, with 1.5 s of slack before it counts as a seek).SpotifyAB.SpotifyMusic_…(Microsoft Store) orSpotify.exe(spotify.com). A browser or another player is never shown.spotify:link, which starts it or brings it forward; when nothing registered that link, the download page.Where Windows differs
All of it is in
windows/README.mdtoo.truetoTryChangeShuffleActiveAsyncandTryChangeAutoRepeatModeAsync, and three seconds later the session still reports them off. I checked that outside Coucou as well. Buttons that do nothing seemed worse than no buttons, so the state carriesmodes(false on Windows, true on Linux) and the card hides the two.spotify:local:<artist>:<album>:<title>id, so an ad is not recognised as one and shows under the name Spotify gives it.spotify-artworkevent, and sent again when its bytes change: Spotify names the new track a moment before it hands over the picture.2. A new song
The real island, with the real Spotify skipping to its next track (muted in the Windows mixer for the recording, hence the volume at zero). The VS Code pill is in front before, and gets its place back after.
When Spotify moves on to another song, the island opens on Spotify's card for three seconds and folds back, and the pill that was in front is in front again. A light in Mochi's colour breathes behind him, the cover glows and a sheen crosses it, so it reads as news and not as an island that opened by accident. No sound: music is playing.
This is #83's announcement, rebuilt on the card and the state machine as they are today. @Edurique is co-author of the commit.
Off by default, with one row under Spotify in Settings → Integrations. The island never opens on its own for news that asks nothing (a finished deploy only shows the compact island), and the Mac does not do this, so it is something to turn on rather than something that starts happening.
What a new song is: one that starts after another. Not the first heard since Spotify started (the compact island already shows for that), not the same one going on after a pause or a seek, never an ad. Windows names a track before it says it plays; it is announced once it does.
Never over the user. Not when the island is open, under the mouse, pinned, or waiting for an answer. The mouse coming, a key or an alert makes it an open island like any other: the auto-close delay applies again, the usual sounds come back, and the front stays where the user sees it. It never takes the keyboard.
The state machine gains
glance(seconds): open, and fold after its own delay instead of the auto-close preference. It is the hover-open's short countdown with another length, and it ends the same way (userInteracted).The light is Mochi's colour, so a colour picked for the pill in Settings → Active pills is the light's too:
Nothing of the card changes outside those three seconds. The light is three one-shot animations under an
announceclass that the card only wears while a song is announced.What differs from #83: three seconds instead of 4.5; off by default instead of on; the light in the Mochi's colour instead of Spotify's green; and the cover stays the card's small one. #83 puts a large cover in Mochi's place, which would restyle the card #372 shipped, so that part is not here.
The repo's rules
windowscrate that is already there.Cargo.lockis unchanged.announceSongs, false when absent from an oldersettings.json.integration_spotify). Its support goes from"linux"to"yes", and the"linux"support kind, which only this pill used, goes away.modesis true there); on Windows it had never been shown. The Settings row follows the rows around it (label, toggle, hint).coucou-spotifythread used 0 ms of CPU in 30 s, while Spotify touched its timeline 7 times. During 10 s of playback the page received 0spotifyevents. With announcements off, a report costs one more comparison; on, one timer per song.extra.jsonin the nine languages. They were written with Claude, not by native speakers: worth a look from someone who speaks them.Tested
Windows 11 Pro (26300), Spotify 1.303.264 from the Microsoft Store, in the built app, driving the island's own commands and listening to its events.
1, the pill
2, a new song
npx tsc --noEmit,npm test(375 pass) andcargo test --workspace --locked(220 + 30 pass) on Windows. For 1: six Rust tests on the parts that need no Spotify (telling its session from the others, the WinRT clock, a reading becoming the island's state, a bad clock or a missing title, cover keys,is_news), and page tests formodesand the pill being offered on both systems. For 2: five tests onglancein the state machine, eight on the page (what a new song is, off by default, the front handed back, a pause between two songs, taken over, songs skipped through, not free / paused / Spotify restarted, the card's light and its colour), one on the setting.tsc, 375 page tests,cargo test --workspace --locked(246 + 34 pass), no warnings in the build. The run.Not tested
Spotify.exeis the app id that build is known by.modes: truein its state; the announcement is page code that Linux runs too, and I have only seen it on Windows.prefers-reduced-motion. The stylesheet does not handle it anywhere yet, and this does not start.Related
#83 (open, from before 0.2.0) adds a Spotify pill to Windows with its own views, and is where the announcement comes from. This one adds no view: a Windows source under #372's page, and that one behaviour.
🤖 Generated with Claude Code