As NYCeyes says in https://unix.stackexchange.com/a/460405/229223, one line is not the complete solution.
My configuration in /etc/systemd/logind.conf.d/local.conf is:
[Login]
HandleLidSwitch=lock
HandleLidSwitchDocked=ignore
HandleLidSwitchExternalPower=lock
- Lines 1 & 3 locks the screen when the laptop is mobile or simply charging, similar to tapping the power button on my phone - make secure.
- Line 2 is to handle plugging in to my docking station (USB-C device with DisplayPort connectors) and lets me close the lid without the laptop assuming I've stopped working, when I'm actually just getting started.
The logind.conf man page from systemd is actually very informative.