Subject: Re: [bug#72714] [PATCH v6] home: services: Add 'home-sway-service-type'.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 30 Sep 2024 22:07:35 +0200

Hi Arnaud,

Arnaud Daby-Seesaram <[email-masked]> skribis:

> * gnu/home/services/sway.scm: New file.
>   (home-sway-service-type): New variable.
>   (sway-configuration->file): New procedure.
>   (sway-configuration): New configuration record.
>   (sway-bar): New configuration record.
>   (sway-output): New configuration record.
>   (sway-input): New configuration record.
>   (point): New configuration record.
>   (sway-color): New configuration record.
>   (sway-border-color): New configuration record.
>   (sway-mode): New configuration record.
>   (flatten): New procedure.
> * gnu/local.mk: Add gnu/home/services/sway.scm.
> * doc/guix.texi (Sway window manager): New node to document the above changes.

I don’t use Sway myself but it looks like a welcome addition.

I trust Hilton’s comment here so here are some more superficial
comments.

> +The @code{(gnu home services sway)} module provides
> +@code{home-sway-service-type}, a home service to configure sway in a
> +declarative way.

To add more context:

“… to configure the @uref{https://github.com/swaywm/sway,Sway window
manager for Wayland} in a declarative way.”

> +@quotation Note
> +This home service only sets up the configuration file and profile
> +packages for sway.  It does @i{not} start sway in any way.  If you want

s/sway/Sway/
s/@i/@emph/

> +@defvar sway-configuration->file

Should be “@deffn {Procedure} sway-configuration->file config”.

> +Here is an example of a service and its configuration that you could add
> +to the @code{services} field of your @code{home-environment}:

I would move the example right before “@quotation Note”.

> +@item @code{always-execs} (default: @code{'()})
> +Programs to execute at startup time @i{and} after every configuration
> +reload.  The value of this field is a list of strings or G-expressions.
> +
> +@item @code{execs} (default: @code{%sway-default-execs})
> +Programs to execute at startup time.  The value of this field is a list
> +of strings or  G-expressions.

Please avoid abbreviations.  Maybe these fields could be called
‘startup+reload-programs’ and ‘startup-programs’?

> +The default value, @code{%sway-default-execs}, executes @code{swayidle}

Likewise, @code{%sway-default-startup-programs}?

> +@deftp {Data Type} sway-input
> +@code{sway-input} records describe input blocks (see@
> +@cite{sway-input(5)}).  For example, the following snippet makes all
> +keyboards use a french layout, in which @kbd{capslock} has been remaped
> +to @kbd{ctrl}:
> +@lisp
> +(sway-input (identifier "type:keyboard")
> +            (xkb-layout "fr")
> +            (xkb-options '("ctrl:nocaps")))
> +@end lisp

Would it be possible here to reuse the <keyboard-layout> record
documented in
<https://guix.gnu.org/manual/devel/en/html_node/Keyboard-Layout.html>?

If it’s possible, that would provide a nicely consistent interface.  If
there’s the need for an extra identifier, maybe you’ll still need
<sway-input>:

  (sway-input (identifier "type:keyboard")
              (layout (keyboard-layout "tr")))

WDYT?

> +@lisp
> +(program-file
> + "sway-bar-status"
> + (with-imported-modules
> +     (source-module-closure
> +      '((ice-9 format) (srfi srfi-19)))

‘with-imported-modules’ can be removed here because (ice-9 format) and
(srfi srfi-19) are provided by Guile itself.

That’s it for me!

Could you send updated patches?

Thank you!

Ludo’.