Help: Using zzz hooks to trigger swaylock pre-suspend
TL;DR, Does anyone have any examples/experience using zzz hooks to trigger a screen locker?
Hi everyone,
I've been using void on my M2 macbook for just under 6 months and have been careful to design a system which is reliable and easy to work on.
I will be traveling more with my laptop and finally decided to stop procrastinating and set up my screen locker correctly as currently I just have to remember to trigger it before closing my lid/suspending which doesn't always happen. To clarify, I use acpid to detect the lid close event and run zzz (I believe this might even be the default config).
After sifting through the man pages i found zzz has suspend/resume hooks which seems great for my usecase. For my system I've steered clear of systemd/logind due to my desire to keep my system simple and easy to work on so 'just use logind' is not an ideal solution in my case, otherwise i would just use swayidle's before-sleep directive and be done with it.
The issue is, swaylock requires both XDG_RUNTIME_DIR and WAYLAND_DISPLAY environment variables which are not present in the env that zzz runs its hooks. Duplicating my logic for these variables from my bash_profile just seems wrong (although I don't see another alternative at this time). My .bash_profile can be found at github.com/unworried/dotfiles.
All feedback and advice is welcome! Thanks to everyone in advance :)
Edit 1: Corrected dotfiles reference, should be .bash_profile not .bashrc.