Skip to content

feat(soundpacks): ship the default sound pack inside the binary - #150

Merged
Orinks merged 1 commit into
devfrom
feat/default-sound-pack
Sep 2, 2026
Merged

feat(soundpacks): ship the default sound pack inside the binary#150
Orinks merged 1 commit into
devfrom
feat/default-sound-pack

Conversation

@Orinks

@Orinks Orinks commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Problem

A fresh install makes no sound. PackManifest::default_pack_json() was an
empty stub, ensure_default_pack() wrote only that stub and no audio, and
neither the installer nor the release workflow copied any sound files. Only
users upgrading from the Python version heard cues, because the
~/.portkeydrop migration carried their old pack across. Surfaced by #149.

Fix

  • The 19 Python-era default cues are back in the repo under
    crates/portkeydrop-core/assets/soundpacks/default/, next to the
    connect_waiting.ogg from feat(soundpack): add the connect_waiting cue audio #149. Each is byte-identical to the blob that was
    in git before the Python app was removed.
  • soundpacks/builtin.rs embeds all 20 with include_bytes! in one table of
    event, pack-relative path, and bytes. The default manifest is generated from
    that table, so the JSON and the files cannot drift. Nothing changes in the
    installer or build.yml; the binary carries the audio, which covers
    nightlies and portable builds too. About 450 KB.
  • ensure_default_pack() writes any built-in file that is missing and adds a
    manifest entry for any built-in event the on-disk manifest lacks. It never
    overwrites a file or an existing entry, so a user who replaced a sound keeps
    it, and existing users gain connect_waiting. An unparseable manifest is
    still left alone, and a complete one is not rewritten.
  • SoundEntry and PackManifest skip None and empty fields when
    serialising, so the rewritten manifest has no nulls.

Tests

  • builtin.rs: every embedded event is in the catalogue, every catalogue
    event has a built-in sound, events and paths are unique, and every embedded
    file decodes.
  • mod.rs: a fresh directory gets every file and resolves every event; a
    user's replacement file is not overwritten; a user-edited manifest keeps its
    entries and gains the rest; a complete manifest is not rewritten; the old
    empty placeholder is filled in.
  • manifest.rs: the generated default lists every built-in sound; a
    manifest round-trips through JSON without null fields.

cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings,
and cargo test --workspace pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_012D47k3ztaJPbaxwNMRYe1C

A fresh install wrote an empty default manifest and no audio, so only
users upgrading from the Python version heard any cues. The twenty
default sounds are now embedded in portkeydrop-core and written to the
packs directory on first start. Missing files and manifest entries are
added on later starts without overwriting anything the user replaced,
so existing installs gain the new connect_waiting cue too.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012D47k3ztaJPbaxwNMRYe1C
@Orinks
Orinks merged commit 6d3c337 into dev Sep 2, 2026
6 checks passed
@Orinks
Orinks deleted the feat/default-sound-pack branch September 2, 2026 18:17
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