I am running Sway on Fedora 26 and want my laptop to be locked when I close my screen. I changed HandleLidSwitch to lock in /etc/systemd/logind.conf and ran systemctl restart systemd-logind after that. However, closing the lid does nothing.
The lock program I intend to use is Swaylock and I can manually call it by runnig the command swaylock in a terminal.
How do I make Systemd call swaylock when it tries to close the screen (as instructed to do in logind.conf)?
/etc/systemd/logind.confis responsible for what happens on LidSwitch, but your window manager may force an inhibitor lock which overrideslogind.conf. Oops,logind.confdoesn't support a script action. I think you can make one script enabling acpid daemon and writing a/etc/acpi/handler.sh. For more info, consultman logind.confand https://bbs.archlinux.org/viewtopic.php?id=158081 and update if you find a solution. I don't have a laptop currently to test it. – Konstantinos Mar 13 '19 at 19:58