Twice now (in seven years) I have accidentally had my keyboard focus in the wrong window as I was typing my password, and accidentally entered it into a groupchat with dozens or hundreds of people. I deleted it in less than three seconds and nobody said anything on either occasion, but that's beside the point. This should never happen and both times I have felt ashamed beyond words, like I was a genuine idiot.
It's just that the shell doesn't show characters as you're typing a password, so if you're looking at the wrong monitor it's just so easy to not see the characters appearing somewhere else as you type, until you hit enter and realize nothing happened and look at your other monitor in dawning horror...
Is there any way to make absolutely sure this never happens? Like maybe drawing a red X near the terminal prompt whenever the window doesn't have focus, somehow?