Which window I have focused is a signal to the computer for the state I want it to be in. For instance, I normally leave my speaker muted so, for example, I don't accidentally play sound from a website with unexpected videos. But this means that when I do want sound, I need to manually unmute the sound, even though I've already told the computer that I want to watch Netflix, which always involves turning on the sound.
Of course, for the particular problem of unmuting the sound, adding a keyboard shortcut and rereading xkcd 1205: Is It Worth the Time? probably would have been a more appropriate solution. But I wanted a general solution to the problem.
Then the following script will unmute the speakers if Netflix is
x11_watch_active_window.py | while read -r FocusApp
if [ "Netflix - Google Chrome" = "$FocusApp" ]
echo Netflix is focused, unmuting.
pactl set-sink-mute 0 0