I'm talking about an unknown or undetected physical presence who may be looking over your shoulder as you view or type in sensitive information or passwords. Most likely to happen when you are supremely focused or using headphones, so not fully aware of your surroundings. What about a device to warn you, or automatically perform some function on your computer to secure the information being displayed?
Yes. There are 'screen-protectors', or anti-glare protectors. A kind of foil you put on your screen so you can only see your screen in a specific angle (your angle). The other person would have hard times viewing your screen. NSA-employees are forced to use this.
Also, on most Unix(-like) systems when you put in your password in the terminal, no asterisk-symbols (*) or characters appear. That's for the same reason. Also for screen-capturing.
Snowden also used a blanket which he put over his head and keyboard when typing in passwords, this to protect against hidden cameras.
And people even experimented with filter-foils to make 'secret-screens'. Screens you can only see with special glasses. https://www.youtube.com/watch?v=zL_HAmWQTgA
But if you really want a device though, you could use a kind of laser alarm system, or beep-alarm when someone passes. You can buy one on Amazon for €/$20 making your own small one. However, I don't think people would appreciate it if you set this up in your public work office.
There are some devices like that, but there's actually an easier approach.
If you really want to keep your screen from being seen then you can make your screen a privacy screen. When someone tries to look at this from odd angles, they can't see anything but dark grey. The screen filters are easy to find at many online retailers(search privacy screen filter). They come in both desktop and laptop sizes and applications.
Of course if you want to go the extra mile there exists a way to make the screen completely unusable by anyone who doesn't have a special pair of polarized filter glasses. To everyone but people with those glasses the screen is completely white! To do this you need to remove the polarized filter from your screen, and install a polarized filter into a pair of glasses(plastic glasses with pop out lenses work well for this).
- Remove the polarized filter from your screen with an Xacto knife(be careful not to damage the underlying surface)
- Pop the lenses out of the plastic glasses and trace the lens shape and size and cut it out of the polarized filter to be used as replacement lenses
- Wear the glasses and look at the screen
There are also more novelty approaches such as "Security Sweaters" and screen shrouds... but those are often bulky and funny looking. That and you can't see anything but the screen then and it really blocks you in.
Of course if you want to go a little less involved you can find programs that use your Webcam as a motion detector to show an on screen alert. If they detect someone behind you the screen has a little alert that pops up. Search Web cam motion alarm and you should find some
Use a password manager for as many passwords as possible. Many gives you the option of copying the password to the clip board, so that you can paste it into the password field without ever displaying it on the screen or entering it on the keyboard.
Off course you still need to type the master password for the password manager and probably a password to log you onto your system. For these, the other answers have interesting suggestions.