Currently, when a notification sound is triggered on Windows, a blank command prompt window briefly pops up (specifically when ffplay or other CLI players are executed via subprocess.run). This interrupts the user experience and briefly steals focus.
Adding just creationflags=0x08000000 (CREATE_NO_WINDOW) is sometimes ignored by ffplay. The most reliable way to completely suppress the console window on Windows is to use subprocess.STARTUPINFO() with the STARTF_USESHOWWINDOW flag alongside the CREATE_NO_WINDOW creation flag.
Suggested Fix:
In contact/message_handlers/rx_handler.py, inside the play_sound() function, replace the standard subprocess.run call with a platform-specific check:
This ensures that the audio player runs completely in the background without displaying a black terminal window to the Windows user, while leaving the behavior unchanged for macOS and Linux.
Currently, when a notification sound is triggered on Windows, a blank command prompt window briefly pops up (specifically when ffplay or other CLI players are executed via subprocess.run). This interrupts the user experience and briefly steals focus.
Adding just creationflags=0x08000000 (CREATE_NO_WINDOW) is sometimes ignored by ffplay. The most reliable way to completely suppress the console window on Windows is to use subprocess.STARTUPINFO() with the STARTF_USESHOWWINDOW flag alongside the CREATE_NO_WINDOW creation flag.
Suggested Fix:
In contact/message_handlers/rx_handler.py, inside the play_sound() function, replace the standard subprocess.run call with a platform-specific check:
```
if platform.system() == "Windows":
su = subprocess.STARTUPINFO()
su.dwFlags |= subprocess.STARTF_USESHOWWINDOW
subprocess.run(
cmd,
check=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
creationflags=0x08000000,
startupinfo=su
)
else:
subprocess.run(
cmd,
check=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
```
This ensures that the audio player runs completely in the background without displaying a black terminal window to the Windows user, while leaving the behavior unchanged for macOS and Linux.
<!-- github-sync-id:5928604105 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Currently, when a notification sound is triggered on Windows, a blank command prompt window briefly pops up (specifically when ffplay or other CLI players are executed via subprocess.run). This interrupts the user experience and briefly steals focus.
Adding just creationflags=0x08000000 (CREATE_NO_WINDOW) is sometimes ignored by ffplay. The most reliable way to completely suppress the console window on Windows is to use subprocess.STARTUPINFO() with the STARTF_USESHOWWINDOW flag alongside the CREATE_NO_WINDOW creation flag.
Suggested Fix:
In contact/message_handlers/rx_handler.py, inside the play_sound() function, replace the standard subprocess.run call with a platform-specific check:
This ensures that the audio player runs completely in the background without displaying a black terminal window to the Windows user, while leaving the behavior unchanged for macOS and Linux.
Looks good, please submit a PR and I'll review.
closed by #320