Skip to content

Conversation

@ubuntupunk
Copy link

🐧 Add Linux Support

Changes

  • Enhanced Platform Detection: Replaced ternary operator with switch
    statement for better maintainability and extensibility
  • Linux MP3 Playback: Added mpg123 -q command for Linux systems
    (specifically designed for MP3 files)
  • Improved Error Handling: Explicit error messages for unsupported
    platforms
  • Updated Documentation: README, CHANGELOG, and OVERVIEW files updated
    to reflect Linux support

Technical Details

  • Windows: start command (built-in)
  • macOS: afplay command (built-in)
  • Linux: mpg123 -q command (requires sudo apt-get install mpg123)

Why mpg123 instead of aplay?

  • aplay is designed for WAV/raw audio files, not MP3
  • mpg123 is specifically built for MP3 playbook
  • The -q flag provides clean, quiet operation
  • Widely available across Linux distributions

Platform Support Matrix

  • ✅ Windows (win32)
  • ✅ macOS (darwin)
  • ✅ Linux (linux)
  • ❌ Other platforms (with clear error message)

Fixes the issue where Linux users would get afplay command not found errors.

Testing

Tested platform detection logic and MP3 playback functionality. Linux user will need to install mpg123:

 sudo apt-get install mpg123  # Ubuntu/Debian                                
  sudo dnf install mpg123      # Fedora                                       
 sudo pacman -S mpg123        # Arch                                         

Commits included:

  • 46085c3 - Switch Linux to mpg123 for MP3 support and add random sound option
  • 8c32379 - Add Linux support via aplay and update documentation

- Implement aplay command in src/index.ts for Linux platform detection
- Update CHANGELOG.md with Linux support in cross-platform audio playback
- Modify README.md and OVERVIEW.md to include Linux in platform support badges/docs
- Maintain bundled sound assets and NPX compatibility for consistent cross-platform behavior

This adds native Linux audio playback using aplay while keeping existing Windows (start) and macOS (afplay) implementations, and updates all documentation to reflect the expanded platform support.
- Replace aplay with mpg123 in Linux platform handling for MP3 compatibility
- Add random sound selection via MCP_NOTIFICATION_SOUND=random environment variable
- Bundle MP3 sound assets in npm package for cross-platform out-of-the-box use
- Enable NPX compatibility with bundled sounds
- Add MIT license to package-lock.json
- Bump version to 0.1.2

This change ensures Linux users can play bundled MP3 notifications using mpg123, which supports MP3 natively unlike aplay. The random sound option enhances user experience by providing variability in notifications.
@mentatbot
Copy link

mentatbot bot commented Jul 11, 2025

If you would like me to review this PR, either tag me in a comment or check this box:

  • Review PR

You can disable automatic comments on my settings page

- Add visual desktop notifications via notify-send (Linux), osascript (macOS), PowerShell (Windows)
- Enhance play_notification tool with show_visual, title, and audio_only parameters
- Maintain backward compatibility with existing audio-only functionality
- Support visual-only notifications for headless environments
- Update documentation with new parameters and cross-platform support
- Detect Qubes OS environment via /proc/xen and qrexec tools
- Implement fallback notification chain: qrexec -> notify-send -> log file
- Add multiple audio methods for Qubes: paplay -> mpg123 -> ffplay
- Handle headless/restricted environments gracefully
- Add audio_only parameter for visual-only notifications
- Add comprehensive styling parameters: urgency, timeout, icon
- Implement Qubes OS detection and multiple fallback mechanisms
- Enhanced notify-send with urgency levels, custom timeouts, and icons
- Graceful error handling for headless and restricted environments
- Multiple audio player fallbacks for Qubes (paplay, mpg123, ffplay, aplay)
- Improved logging and console output for debugging
- Update documentation with new styling capabilities
- Replace nested try-catch with clean fallback array pattern for audio
- Add graceful error handling for visual notifications
- Implement Qubes-aware error handling (log but don't fail)
- Enhanced response messaging with urgency levels and Qubes detection
- Ensure notifications work even when individual methods fail
- Maintain user experience with informative success messages
Introduce modular templates for backup, build, deploy, error, info, success, test, and warning notifications. Each template defines default title, message, urgency, timeout, icon, and sound. Update `src/index.ts` to import and apply these templates, adding a `template` parameter with enum support to the notification request handler. This enables consistent, reusable notification configurations with action-specific audio/visual cues.
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