Artix Linux Forum

Artix Linux => System => Topic started by: ZenRen on 17 January 2019, 22:31:13

Title: How can I run my lockscreen script on suspend/hibernate
Post by: ZenRen on 17 January 2019, 22:31:13
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
Title: Re: How can I run my lockscreen script on suspend/hibernate
Post by: ryukinix on 13 February 2019, 03:03:53
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.
Title: Re: How can I run my lockscreen script on suspend/hibernate
Post by: ryukinix on 16 February 2019, 01:27:51
I solved this as follow: https://gist.github.com/ryukinix/bd0c1ddcbbafdb4149ae70e41b7c822b

Title: Re: How can I run my lockscreen script on suspend/hibernate
Post by: nous on 16 February 2019, 19:44:47
Good job, I put it on the wiki (https://wiki.artixlinux.org/Main/Elogind#Execute_a_script_at_suspend).