I use LightDM and dm-tool lock to manually lock the session, but I want that this happens automatically after the user has been auto-logged in.
Can I use a script for this? Where would I have to store it, e.g. in /usr/bin/, and how would I have this script executed after auto-login? I must ensure that the script is not executed after manual login, of course.
Fair enough. In that case (since I’m assuming you’re not really interested in the security implications), you could set the auto-lock timer to something like 1s. Not sure where to set that in LightDM, but I’m sure google will help you out there.
A universal (or DE-agnostic) option is to use a bash script that locks your screen with a DE-agnostic screenlocker like betterlockscreen. Set the timer to whatever you want in the script.