macOS' sound settings can be modified in the System Preferences → Sound menu. In particular, you can change how Sound Effects and outputted audio is played (e.g., what device the computer should use), and how sound is received (e.g., what microphone to use).
I have a pair of Bluetooth headphones that can sync with more than one device. This is useful when you don't want to think too much about which device is currently paired when you're playing music or whatever. However, when paired with the Mac, even if it isn't being used for sound output, a sound effect will interrupt playback coming from another device and force the headphones to listen to the computer for a moment.
It's easy to change this setting in the System Preferences → Sound → Sound Effects tab. You can tell the computer to output playback to the headphones, but to output sound effects through internal speakers. The problem is that this setting switches back, making the headphones the destination for both, every time the headphones are turned on again.
So: is there a way to force macOS to always use internal speakers for sound effects?