I'm on runit and using loginctl for everything. My lockscreen script shuts down media and runs i3lock and it works, but I cant get it to lock and suspend. I tried putting the script in /usr/lib/elogind/system-sleep/ and it took noticeably longer to suspend, but it didn't lock, I don't know if it had anything to do with the "sleep 5" in my script or not. Wondering if theres a good way to go about this, thanks.
Edit: I would love if it worked along with loginctl so I didn't have to edit anything else, anything that wants to suspend will lock too. I don't know if the systax is wrong or something
I'm very interested on this feature. I'm thinking to use elogind system-sleep hooks for that, but the way I wrote just doesn't works with slock.
I solved this as follow: https://gist.github.com/ryukinix/bd0c1ddcbbafdb4149ae70e41b7c822b
Good job, I put it on the wiki (https://wiki.artixlinux.org/Main/Elogind#Execute_a_script_at_suspend).