Repository navigation
Windows support: mpv over a named pipe, media keys, notifications and a Start Menu entry - #37
Open
XiaTian-AC wants to merge 4 commits into
Open
XiaTian-AC wants to merge 4 commits into
XiaTian-AC wants to merge 4 commits into
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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
Makes cloofy build and run on Windows, with the same two services and the OS integration the platform has equivalents for: YouTube Music over mpv, Spotify over librespot/WASAPI, media keys and Now Playing (SMTC), desktop notifications, sleep/wake, reduced motion and power saving, Credential Manager, and a Start Menu entry.
Supersedes #36, which I opened before running the CI steps and which carried a clippy failure. Same branch, one line different.
The Spotify build already compiled on Windows untouched; the work below is mostly about the parts that were Unix-only by construction.
How
mpv IPC (
crates/cloofy-ytmusic/src/player/mpv.rs). The Unix path uses a socketpair and--input-ipc-client=fd://N. Windows has nosocketpair, and mpv's documented Windows side is--input-ipc-server=\\.\pipe\…, where mpv is the server. So the Windows build spawns mpv with a per-instance pipe name (\\.\pipe\cloofy-<pid>-<n>), connects as a client with a short retry while mpv creates it, and addsCREATE_NO_WINDOWso no console flashes.Mpvkeeps one reader/writer abstraction; everything above it is unchanged.crates/cloofy-os/src/windows/— a third platform next tomacos/andlinux/, using the existing traits:media.rs—MediaPlayer+SystemMediaTransportControlswith automatic integration disabled, so the buttons go throughCommandlike everywhere else. WinRT objects are notSend, so they live on one thread andupdate()posts to it.notifications.rs— toast throughToastNotificationManager, replacing the previous one by tag/group, cover as afile:///image.Nonewhen the shortcut is missing, because a toast without an AUMID fails silently.power.rs—RegisterSuspendResumeNotification→Event::Sleep/Wake.settings.rs—SPI_GETCLIENTAREAANIMATIONfor reduced motion,GetSystemPowerStatusfor battery saver.secrets.rs— Credential Manager. Its 2560-byte blob limit matters: the YouTube cookies exceed it, soSecretgrows a real fallback chain incloofy-core/src/paths.rs(write falls back to the file, and reading a file that is too large no longer fails while migrating).cloofy windows install|status|remove— the same shape ascloofy omarchy install|status|remove: it creates the Start Menu shortcut withSystem.AppUserModel.ID = dev.cloofy.cloofy, which is what Windows needs before it will show a toast.packaging/windows/hasinstall.ps1/uninstall.ps1(PATH is untouched unless asked for) and scoop manifests for later.Smaller things:
cloofy login ytmusiclearns the Windows browser locations (theknown()table was XDG/.apponly);update::supported()lets the UI say "build it yourself" instead of offering an update that cannot be installed;config.rs's keychain check now accepts Windows;.github/workflows/ci.ymlgets awindows-latestjob that installs NASM/mpv and runs the same checks as Linux.Verification
On Windows 11, Rust 1.98:
cargo build --locked -p cloofy --no-default-features --features ytmusic, the same forspotify,cargo clippy --workspace --all-targets --locked -- -D warnings, andcargo test --workspace --lockedwithCLOOFY_REQUIRE_MPV=1. All pass.CLOOFY_REQUIRE_MPV=1 cargo test -p cloofy-ytmusic --lib— 90 pass, several of them spawn a real mpv over the new pipe.cargo checkforx86_64-unknown-linux-gnuandaarch64-apple-darwin, so the other platforms are untouched.GlobalSystemMediaTransportControlsSessionManager,cloofy windows install/removeanduninstall.ps1work.Not in this PR
IMMNotificationClient; sleep/wake is separate).crates/cloofy/tests/smoke.rsusesopenpty; a Windows version needsCreatePseudoConsole.update()therefore reports "no prebuilt cloofy for this system" rather than downloading something.For the reviewer
cargo test --workspacefails 8cloofy-tuisnapshot tests on a machine withcore.autocrlf=true(the fixtures come out CRLF, the harness renders LF); the content is identical, and CI'sactions/checkoutdoesn't set that. The new Windows CI job has not run yet — this is the first push that will exercise it.