Le Sat, Nov 11, 2023 at 10:13:47AM +0000, Matthieu Herrb a écrit :
> 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 :-).

you mean this ?

https://github.com/openbsd/xenocara/blob/master/app/xlockmore/xlock/passwd.c#L1311

sure, can add that part, but the screensavers (eg xfce, mate, gnome) i
copied the auth_userokay bits from dont have it either :)

https://gitlab.gnome.org/Archive/gnome-screensaver/-/blob/master/src/gs-auth-bsdauth.c?ref_type=heads#L74

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

good point, will do.

> 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.

imo proper screen locking seems like basic daily usage for regular
OpenBSD users :)

Reply via email to