hi,

here's two ports for swaylock and its companion swayidle, i've been able
to test it in a sway/wayland session with

swayidle -d timeout 10 'swaylock -f -c 00ff00' timeout 20 'swaymsg "output * 
dpms off"' resume 'swaymsg "output * dpms on"'

which translates to 'after 10 seconds idle, lock the screen', 'after 20
seconds idle shut down the screen via dpms', and 'on resume wake on the
screen', and if after 20s i type a key, swaylock prompts for my
password, and correctly typing it unlocks the screen via
bsdauth/auth_userokay.

ofc one can run swaylock manually, it'll just lock the screen - to note,
if you kill the swaylock process, it paints the screen red before dying,
so you cant recover your display this way (use ssh :).

The wordexp() use is awkward so i've replaced it by an ugly handrolled
lookup for configs in:
- $HOME/.sway{idle,lock}/config
- $XDG_CONFIG_HOME/sway{idle,lock}/config
- $HOME/.config/sway{idle,lock}/config if $XDG_CONFIG_HOME is unset
- and fallback to /etc/sway{lock,idle}/config

the wordexp() use for paths/image locations was also super awkward, but
with image=/usr/local/share/backgrounds/xfce/xfce-blue.jpg
in ~/.config/swaylock/config swaylock correctly loads the background
image, so just use full paths... or rely on $PATH for swayidle commands.

feedback on the bsdauth.c file much welcome, i've tried mimicking as
much as possible what the various {x,mate-,xfce-,gnome-}screensaver are
doing.

oks welcome too, i'll try to push my modifications upstream as i've tried
making them the less intrusive possible.

Landry

Attachment: swaylock-idle.tgz
Description: application/tar-gz

Reply via email to