Le Thu, Nov 09, 2023 at 11:38:41AM +0100, Landry Breuil a écrit :
> 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.

now with 100%+ more parse_line_like_wordexp_does() manually rolled
(thanks tb!)...  and 100%+ more malloc return values checked. with that
horror i'm able to run swayidle with this in .config/swayidle/config:
timeout 10 'swaylock -f -c 00ff00'
timeout 20 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'

honest feedback (eg not rocks) on the bsdauth bits, the wordexp
replacement bits & the meson changes welcome.

i'll talk to upstream about its wordexp use..

Landry

Attachment: swaylock+swayidle_2.tgz
Description: application/tar-gz

Reply via email to