On Thu, Nov 09, 2023 at 05:50:13PM +0100, Landry Breuil wrote:
> 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.
> 

The bsd_auth part doesn't handle the style:pass syntax that is
supported by many bsdauth based tools (including xenodm and xlock :-).

Also I would add an explicit_bzero(buf) after checking the password
but I see that I didn't add it to xlock either.

but ok to import as is from me. we can always improve it
in tree later. I don't know how many OpenBSD depend on that feature.

-- 
Matthieu Herrb

Reply via email to