Skip to content

fix: cross-platform desktop notifications in VoiceServer#1030

Open
qozle wants to merge 1 commit intodanielmiessler:mainfrom
qozle:fix/linux-desktop-notifications
Open

fix: cross-platform desktop notifications in VoiceServer#1030
qozle wants to merge 1 commit intodanielmiessler:mainfrom
qozle:fix/linux-desktop-notifications

Conversation

@qozle
Copy link
Copy Markdown

@qozle qozle commented Apr 3, 2026

Summary

  • Replaces hardcoded /usr/bin/osascript call with cross-platform sendDesktopNotification() function
  • macOS: unchanged behavior (osascript with AppleScript escaping)
  • Linux: uses notify-send if available, logs warning if not
  • Follows the same pattern as the existing getAudioPlayer() which already handles cross-platform audio

Problem

On Linux, every notification triggers an ENOENT error:

ENOENT: no such file or directory, posix_spawn '/usr/bin/osascript'

Test plan

  • Verified on Ubuntu 24.04 — notify-send called, no ENOENT
  • macOS path unchanged — same osascript call with AppleScript escaping
  • Graceful fallback when neither tool available

Fixes #855
Relates to #685

Replace hardcoded /usr/bin/osascript with platform-detected
sendDesktopNotification() that uses osascript on macOS and
notify-send on Linux. Missing notify-send logs a warning
instead of throwing ENOENT.

Fixes danielmiessler#855
Relates to danielmiessler#685
MHoroszowski added a commit to MHoroszowski/Personal_AI_Infrastructure that referenced this pull request Apr 11, 2026
playAudio() hardcoded /usr/bin/afplay, which is macOS-only. On Linux,
every TTS notification fails with ENOENT and the voice server appears
to work but produces no audio (the failure is swallowed by the
fire-and-forget curl pattern used at the call sites).

Extract player resolution into getAudioPlayer():
- darwin           → afplay  (unchanged)
- linux + ffplay   → ffplay -nodisp -autoexit -volume 0..100
- linux + mpg123   → mpg123 -f 0..32768 (PCM scale)
- neither          → throw with an actionable install hint

ffplay is preferred because ffmpeg is widely preinstalled; mpg123 is
the lightweight fallback. Both route through PulseAudio, so this works
on native Linux and on Windows via WSL2 + WSLg out of the box.

Verified on Ubuntu 24.04 / WSL2 (Windows 11): TTS audio plays through
WSLg PulseAudio to Windows speakers with no additional configuration.

Addresses the audio-playback half of danielmiessler#855. Complementary to danielmiessler#1030,
which covers the desktop-notification half (osascript → notify-send)
without overlap.
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.

VoiceServer: afplay (macOS-only) breaks audio on Linux — silent failure

1 participant