feat: Linux sound playback with auto-detected player (#7) - #10
Open
kenlacroix wants to merge 1 commit into
Open
Conversation
…zyk#7) Linux has no universal way to play a sound, so probe for a player on PATH (paplay, pw-play, aplay, ffplay, cvlc) and use the freedesktop sound theme by default. Player and sound paths are overridable via --sound-player and the BREATHE_SOUND_PLAYER / BREATHE_SOUND_INHALE / BREATHE_SOUND_EXHALE env vars. Falls back to the terminal bell when no player or sound file is found. Mirrors the existing afplay/winsound structure: non-blocking Popen in play_sound, a new 'linux' branch in check_audio, stdlib-only, single-file. Adds unit tests for the resolution/fallback logic and updates README, CLAUDE.md, and the pyproject Linux classifier. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kenlacroix
marked this pull request as ready for review
June 27, 2026 06:50
|
Tested on Arch Linux, works perfectly. Thank you 👍 |
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.
Closes #7.
Adds Linux sound playback, mirroring the existing macOS (
afplay) / Windows (winsound) structure — stdlib-only, single-file, with a graceful terminal-bell fallback.What it does
shutil.which, probingpaplay→pw-play→aplay→ffplay→cvlc. New'linux'branch incheck_audio(); non-blockingPopeninplay_sound()(same asafplay).ffplay/cvlcget the extra args they need to exit cleanly without a window./usr/share/sounds/freedesktop/stereo/message.oga,complete.oga), since Linux has no universal system-sound path.--sound-player CMDflag plusBREATHE_SOUND_PLAYER/BREATHE_SOUND_INHALE/BREATHE_SOUND_EXHALEenv vars.52/52pass) + README/CLAUDE.md/pyproject updates.Verified on Linux (PipeWire/PulseAudio): detects
paplay, resolves the freedesktop sounds, and plays the cues.Decisions on the 3 questions from #7
No strong steer came back, so I went with the lighter leans below — each is a one-line change if you'd prefer otherwise:
--sound-playeroverride (keeps the line count down). Can add--sound-inhale/--sound-exhaleflags for full CLI parity if you'd like.paplay(PulseAudio) beforepw-play(PipeWire). Easy to flip.Marking ready for review — happy to adjust any of the above to match your preference.