I use a Yubikey which I use for GPG signing, and for TOTP auth, so it’s continually plugged in to my computer when I’m doing my work.
It’s on my keys with my lift pass, so I always take it with me when I’m leaving the building, and of course I always lock my computer as well. Being ~lazy~efficient I’ve wired up ControlPlane so that it starts my screensaver whenever I unplug my Yubikey.
It’s sort of a hack, as ControlPlane is a tool for making your computer do things such as mute your volume or change default printer based on which context you are arriving at or leaving from, however you can have a context be based on if a USB device is attached (like my Yubikey)
When installing ControlPlane it will ask if you want multiple contexts (you do)
Create a context for your Yubikey
Make sure Attached USB Device is set a Evidence Source
Create a rule for your Yubikey to set the context to Yubikey (and then set the confidence to high)
Create an action for Screensaver Start Now (it’s in the System Preferences menu), set the context to Yubikey, and set it to On departure
Now, remove your Yubikey