[PR #12281] Two belling fixes #28959

Open
opened 2026-01-31 09:31:52 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/12281

State: closed
Merged: Yes


Sorry for combining two fixes in one PR. I can separate if need be.

  • Closes #12276:
    • "bellSound": null didn't work. This one was easier, and is atomically in bcc2ca04fc. Basically, we would deserialize that as an array with a single empty string in it, which we'd try to then play. I think it's more idomatic to have that deserialized as an empty array, which correctly falls back to playing the default sound.
  • Closes #12258:
    • This one is the majority of the rest of the PR. If you leave the MediaPlayer open, then the media keys will affect the Terminal. More importantly, once the bell sounds, they'd replay the bell, which is insane. So the fix is to re-create the media player when we need it. We do this per-pane for simpler lifetime tracking. I'm not worried about the overhead of creating a mediaplayer here, since we're already throttling bells.
  • Originally added in #11511
  • Tested manually
    • Use no.mp4 for this since that's like, 17s long
    • Checked that closing panes / the terminal while a bell was playing didn't crash
    • Playing a bunch of bells at once works
    • closing a pane stops the bell it's playing
    • once the bell stops, the media keys went back to working for Spotify
  • I work here
**Original Pull Request:** https://github.com/microsoft/terminal/pull/12281 **State:** closed **Merged:** Yes --- Sorry for combining two fixes in one PR. I can separate if need be. * [x] Closes #12276: - `"bellSound": null` didn't work. This one was easier, and is atomically in bcc2ca04fc14f39f37849b4bd837ad6cdb4cdaaa. Basically, we would deserialize that as an array with a single empty string in it, which we'd try to then play. I think it's more idomatic to have that deserialized as an empty array, which correctly falls back to playing the default sound. * [x] Closes #12258: - This one is the majority of the rest of the PR. If you leave the MediaPlayer open, then the media keys will _affect the Terminal_. More importantly, once the bell sounds, they'd replay the bell, which is insane. So the fix is to re-create the media player when we need it. We do this per-pane for simpler lifetime tracking. I'm not worried about the overhead of creating a mediaplayer here, since we're already throttling bells. * Originally added in #11511 * [x] Tested manually - Use [`no.mp4`](https://www.youtube.com/watch?v=x2w9TyCv2gk) for this since that's like, 17s long - Checked that closing panes / the terminal while a bell was playing didn't crash - Playing a bunch of bells at once works - closing a pane stops the bell it's playing - once the bell stops, the media keys went back to working for Spotify * [x] I work here
claunia added the pull-request label 2026-01-31 09:31:52 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28959