I am trying to configure my laptop running LUbuntu 18.04 to first go to the login screen, and then after the login screen is displayed, the suspend. The reason for this is that the default of simply suspending and then displaying the login screen on resume results in a delay of about 5 seconds before the login screen is displayed upon resume, whereas if the login screen is already up when the machine is suspended, it is available almost instantly on resume.
In any case, I have been researching how to do this, and it seems like my best option is to simply run a script when the lid is closed which first calls
dm-tool lock followed by a delay if needed to wait for the login screen to be display, and then
However, how to I link the action of the lid being closed to running this script? From my research it appears that
acpid is the way to go. From reading the man page, it appears that there needs to be an executable script in
lidbtn. The directory exists on my system but no such script exists, and the man page is unclear as to exactly what it needs to contain. Looking at the other scripts in this directory it appears that I need to know what to put for the "event=" line, but I haven't found this anywhere.
There is also mention of the window manager handling this event, and it is unclear what I need to do to make sure my script doesn't conflict with that. Under the Xfce Power Manager (Menu -> Preferences -> Power Manager) under the General tab I see "When laptop lid is closed"... Suspend, but the only other choices are "Switch off display" and "Lock screen". There is no choice for "do nothing". What do I need to do here? Does the requested action happen before or after whenever acpid script I might create get executed, or does that completely override this?