So, tab on its own brings up or cancels the command UI.
If you're piloting your flagship, or on the command UI, pressing command-tab (specifically, press-and-hold command, then hit tab) will swap to a different program with no effect on Starsector. If you were viewing your flagship, you stay viewing your flagship. If you were on the command UI, you stay on the command UI.
So far so good.
However, if you're viewing another ship via show video feed, then command-tab will swap you to a different program and cancel the video feed, punting you back to the command UI. Which is highly inconvenient, and I'd appreciate if the game didn't do that.