[PR #12281] [MERGED] Two belling fixes #28954

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12281
Author: @zadjii-msft
Created: 1/28/2022
Status: ✅ Merged
Merged: 1/31/2022
Merged by: @undefined

Base: main ← Head: dev/migrie/b/must-fix-honks


📝 Commits (10+)

📊 Changes

4 files changed (+56 additions, -39 deletions)

View changed files

📝 src/cascadia/TerminalApp/Pane.cpp (+50 -36)
📝 src/cascadia/TerminalApp/Pane.h (+2 -1)
📝 src/cascadia/TerminalSettingsModel/JsonUtils.h (+4 -1)
📝 src/cascadia/TerminalSettingsModel/Profile.cpp (+0 -1)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/12281 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 1/28/2022 **Status:** ✅ Merged **Merged:** 1/31/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/b/must-fix-honks` --- ### 📝 Commits (10+) - [`10ac865`](https://github.com/microsoft/terminal/commit/10ac865fafbb1aab588f4784e9234249dcc2c817) This fixes the media controls thing, nut I need to remove the bodgy - [`3873146`](https://github.com/microsoft/terminal/commit/3873146e2691c2a9449ca8c58e201b4b454a5140) Yea we don't need this - [`59a6377`](https://github.com/microsoft/terminal/commit/59a6377a1224e5d350356e264f9bc47434d7fcd4) This was one idea but I have a better one - [`2fd955e`](https://github.com/microsoft/terminal/commit/2fd955ec58600bad9ece6e797a34f122d7d51f11) Revert "This was one idea but I have a better one" - [`bcc2ca0`](https://github.com/microsoft/terminal/commit/bcc2ca04fc14f39f37849b4bd837ad6cdb4cdaaa) fixes #12276 - [`c4e967c`](https://github.com/microsoft/terminal/commit/c4e967cdc50832407eb843da9609a3e19038e6ee) Okay this is dirty but it works and doesn't crash anymore - [`609e6c5`](https://github.com/microsoft/terminal/commit/609e6c544bfe91b08af2ee2b279ad3aa771d2871) Clean the code up and add comments - [`564b9f2`](https://github.com/microsoft/terminal/commit/564b9f2f65983d62140edd97793b72422e09e0e3) dead code - [`d442fbd`](https://github.com/microsoft/terminal/commit/d442fbdb9e8a225e16345a61b4027cfefb9978c7) Merge remote-tracking branch 'origin/main' into dev/migrie/b/must-fix-honks - [`d2b2ee6`](https://github.com/microsoft/terminal/commit/d2b2ee6c78faf4f41d798e044f7738d411cb5bbd) make it clear this is weak ### 📊 Changes **4 files changed** (+56 additions, -39 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/Pane.cpp` (+50 -36) 📝 `src/cascadia/TerminalApp/Pane.h` (+2 -1) 📝 `src/cascadia/TerminalSettingsModel/JsonUtils.h` (+4 -1) 📝 `src/cascadia/TerminalSettingsModel/Profile.cpp` (+0 -1) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:31:51 +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#28954