You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows support: mpv over a named pipe, media keys, notifications and a Start Menu entry - #36
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.
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 no socketpair, 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 adds CREATE_NO_WINDOW so no console flashes. Mpv keeps one reader/writer abstraction; everything above it is unchanged.
crates/cloofy-os/src/windows/ — a third platform next to macos/ and linux/, using the existing traits:
media.rs — MediaPlayer + SystemMediaTransportControls with automatic integration disabled, so the buttons go through Command like everywhere else. WinRT objects are not Send, so they live on one thread and update() posts to it.
notifications.rs — toast through ToastNotificationManager, replacing the previous one by tag/group, cover as a file:/// image. None when the shortcut is missing, because a toast without an AUMID fails silently.
settings.rs — SPI_GETCLIENTAREAANIMATION for reduced motion, GetSystemPowerStatus for battery saver.
secrets.rs — Credential Manager. Its 2560-byte blob limit matters: the YouTube cookies exceed it, so Secret grows a real fallback chain in cloofy-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 as cloofy omarchy install|status|remove: it creates the Start Menu shortcut with System.AppUserModel.ID = dev.cloofy.cloofy, which is what Windows needs before it will show a toast. packaging/windows/ has install.ps1 / uninstall.ps1 (PATH is untouched unless asked for) and scoop manifests for later.
Smaller things: cloofy login ytmusic learns the Windows browser locations (the known() table was XDG/.app only); 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.yml gets a windows-latest job that installs NASM/mpv and runs the same checks as Linux.
Verification
On Windows 11, Rust 1.98:
cargo check/build for --features ytmusic and --features spotify.
CLOOFY_REQUIRE_MPV=1 cargo test -p cloofy-ytmusic --lib — 89 pass, several of them spawn a real mpv over the new pipe.
cargo test -p cloofy-core, -p cloofy-os; cargo check --workspace --all-targets.
cargo check for x86_64-unknown-linux-gnu and aarch64-apple-darwin, so the other platforms are untouched.
The app runs: YouTube Music plays, covers draw, the media session appears to GlobalSystemMediaTransportControlsSessionManager, cloofy windows install/remove and uninstall.ps1 work.
Not in this PR
Pausing when the default output device changes (needs an IMMNotificationClient; sleep/wake is separate).
crates/cloofy/tests/smoke.rs uses openpty; a Windows version needs CreatePseudoConsole.
Windows release artifacts. update() therefore reports "no prebuilt cloofy for this system" rather than downloading something.
For the reviewer
cargo test --workspace fails 8 cloofy-tui snapshot tests on a machine with core.autocrlf=true (the fixtures come out CRLF, the harness renders LF); the content is identical, and CI's actions/checkout doesn't set that. The new Windows CI job has not run yet — this is the first push that will exercise it.
Summary by CodeRabbit
New Features
Added Windows support for YouTube Music and Spotify, including media controls, desktop notifications, sleep/wake handling, and Credential Manager sign-ins.
Added Windows installation, status, and removal commands, plus installer and package-manager setup options.
On systems without downloadable updates, the app now explains that updating requires building locally.
Documentation
Added Windows setup and platform guidance, including prerequisites, notification behavior, and uninstall details. નોંધ
This change adds Windows support for media playback, notifications, power events, settings, credentials, browser discovery, installation, and update handling. It also adds Windows CI coverage and documents Windows setup and platform behavior.
Windows-specific OS dependencies and module selection are added. Keychain configuration recognizes Windows, and oversized secrets use file-backed storage when keychain writes return InvalidInput.
Windows OS services crates/cloofy-os/src/windows/*
Windows implementations add media controls, toast notifications, sleep and wake monitoring, settings detection, and Credential Manager support.
Windows playback, commands, and packaging
Layer / File(s)
Summary
Browser discovery and mpv IPC crates/cloofy-ytmusic/src/auth.rs, crates/cloofy-ytmusic/src/player/*
YouTube Music browser discovery checks Windows profile roots. mpv uses named-pipe IPC on Windows, with shared asynchronous reader and writer interfaces.
Windows shortcut commands and packaging crates/cloofy/Cargo.toml, crates/cloofy/src/main.rs, crates/cloofy/src/windows.rs, packaging/windows/*
The cloofy windows command manages the Start Menu shortcut. Installer and uninstaller scripts manage the binary and PATH entries, and Scoop manifests describe the Spotify and YouTube Music packages.
TUI, CI, and documentation
Layer / File(s)
Summary
Update and notification handling crates/cloofy-core/src/update.rs, crates/cloofy-tui/src/app/mod.rs, crates/cloofy-tui/src/notify.rs, crates/cloofy-tui/src/scenarios.rs, crates/cloofy-tui/src/ui/topbar.rs
The updater displays local-build instructions when a release has no build for the current system. The TUI desktop notification channel now includes Windows.
CI and Windows documentation .github/workflows/ci.yml, CHANGELOG.md, README.md, packaging/windows/README.md
CI builds both Windows service variants and runs workspace checks. The documentation describes Windows setup, installation, and platform behavior.
sequenceDiagram
participant Cloofy
participant Ipc
participant mpv
participant NamedPipe
Cloofy->>Ipc: Configure Windows IPC
Ipc->>mpv: Start with named-pipe server argument
mpv->>NamedPipe: Open IPC pipe
Ipc->>NamedPipe: Retry connection until connected or timeout
NamedPipe-->>Ipc: Provide asynchronous reader and writer
Ipc-->>Cloofy: Return IPC streams
Loading
Suggested reviewers:yk-sgr
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Sorry — I opened #36 before running the CI steps. A clippy warning in a test (clippy::to_string_in_format_args) would have failed the new Windows job on its first run. I've now reproduced the job locally (both --locked builds, cargo clippy --workspace --all-targets --locked -- -D warnings, and cargo test --workspace --locked with CLOOFY_REQUIRE_MPV=1), fixed the warning, and opened a fresh PR so the diff starts clean rather than showing a broken first push.
Nothing about the design changed; this is the same branch, one line different.
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
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.
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 check/buildfor--features ytmusicand--features spotify.CLOOFY_REQUIRE_MPV=1 cargo test -p cloofy-ytmusic --lib— 89 pass, several of them spawn a real mpv over the new pipe.cargo test -p cloofy-core,-p cloofy-os;cargo check --workspace --all-targets.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.Summary by CodeRabbit