Subject: Re: [PATCH v8] home: services: Add 'home-sway-service-type'.

From: "pelzflorian (Florian Pelz)" <[email-masked]>
Date: Sat, 12 Oct 2024 15:11:56 +0200

Pushed as b64f7984a5e2aba04df72a92f0044e423efe77c6,
Change-Id: I880261570c5afdb795f2ce18bac2b9a5c898677f
with tiny changes.

---
 doc/guix.texi              | 16 ++++++++--------
 gnu/home/services/sway.scm | 24 ++++++++----------------
 2 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 0f45ef3b15..ddbff8bc23 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47170,13 +47170,13 @@ Sway window manager
 want to do so, you might be interested in using
 @code{greetd-wlgreet-sway-session} instead.
 
-The function @code{sway-configuration->file} defined below can be used
+The proceedure @code{sway-configuration->file} defined below can be used
 to provide the value for the @emph{optional} @code{sway-configuration}
 field of @code{greetd-wlgreet-sway-session}.
 @end quotation
 
 @deffn {Procedure} sway-configuration->file config
-This function takes one argument @code{config}, which must be a
+This procedure takes one argument @code{config}, which must be a
 @code{sway-configuration} record (defined below), and returns a
 file-like object representing the serialized configuration.
 @end deffn
@@ -47263,11 +47263,11 @@ Sway window manager
 @item @code{startup+reload-programs} (default: @code{'()})
 Programs to execute at startup time @emph{and} after every configuration
 reload.  The value of this field is a list of strings, G-expressions or
-file-append objects (@pxref{G-Expressions}).
+file-like objects (@pxref{G-Expressions}).
 
 @item @code{startup-programs} (default: @code{%sway-default-execs})
 Programs to execute at startup time.  As above, values of this field are
-a list of strings, G-expressions or file-append objects.
+a list of strings, G-expressions or file-like objects.
 
 The default value, @code{%sway-default-execs}, executes @code{swayidle}
 in order to lock the screen after 5@ minutes of inactivity (displaying a
@@ -47283,7 +47283,7 @@ Sway window manager
 @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
+keyboards use a French layout, in which @kbd{capslock} has been remapped
 to @kbd{ctrl}:
 @lisp
 (sway-input (identifier "type:keyboard")
@@ -47365,8 +47365,8 @@ Sway window manager
 the wallpaper will be displayed.  It must be a symbol among
 @code{stretch}, @code{fill}, @code{fit}, @code{center} and @code{tile}.
 
-If the second element is not specified (@i{i.e.}@: when the value not a
-pair), the @code{fill} mode will be used.
+If the second element is not specified (@i{i.e.}@: when the value is not
+a pair), the @code{fill} mode will be used.
 @end itemize
 
 @quotation Note
@@ -47444,7 +47444,7 @@ Sway window manager
 @item @code{colors} (optional)
 An optional @code{sway-color} configuration record.
 
-@item @code{status-command} (default: @code{%sway-status-command})
+@item @code{status-command} (optional)
 This field accept strings, G-expressions and executable file-like
 values.  The default value is a command (string) that prints the date
 and time every second.
diff --git a/gnu/home/services/sway.scm b/gnu/home/services/sway.scm
index 9401c80400..0e1a2d57b2 100644
--- a/gnu/home/services/sway.scm
+++ b/gnu/home/services/sway.scm
@@ -20,9 +20,6 @@ (define-module (gnu home services sway)
   #:use-module (guix modules)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
-  #:use-module (srfi srfi-26)
-  #:use-module (ice-9 popen)
-  #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:use-module (guix packages)
   #:use-module (gnu system keyboard)
@@ -52,7 +49,6 @@ (define-module (gnu home services sway)
             %sway-default-gestures
             %sway-default-modes
             %sway-default-keybindings
-            %sway-default-status-command
             %sway-default-startup-programs
             %sway-default-packages))
 
@@ -221,7 +217,7 @@ (define-configuration/no-serialization sway-bar
    "Color palette of the bar.")
   (status-command
    maybe-status-command
-   "Status command.  It must be file-like.")
+   "Status command.")
   (mouse-bindings
    (mouse-bindings '())
    "Actions triggered by mouse events.")
@@ -275,7 +271,6 @@ (define-configuration/no-serialization sway-mode
   (mouse-bindings
    (mouse-bindings '())
    "Mouse bindings."))
-;; TODO (not necessary for 72714): switch bindings.
 
 (define (sway-modes? lst)
   (every sway-mode? lst))
@@ -327,10 +322,10 @@ (define sway-menu
    (with-imported-modules
        (source-module-closure '((guix build utils)))
      #~(begin
-         (use-modules (ice-9 popen)
+         (use-modules (ice-9 ftw)
+                      (ice-9 popen)
                       (ice-9 receive)
                       (ice-9 rdelim)
-                      (ice-9 ftw)
                       (guix build utils)
                       (srfi srfi-1))
 
@@ -351,7 +346,7 @@ (define sway-menu
                                     "/.guix-home/profile/bin"))
                (wmenu #$(file-append wmenu "/bin/wmenu"))
                (swaymsg #$(file-append sway "/bin/swaymsg")))
-           (receive (from to pid)
+           (receive (from to pids)
                (pipeline `((,wmenu)))
              (for-each
               (lambda (c) (format to "~a~%" c))
@@ -359,8 +354,8 @@ (define sway-menu
              (close to)
              (let ((choice (read-line from)))
                (close from)
-               (waitpid (first pid))
-               (when (string? choice) ;do not attempty to launch if no choice
+               (waitpid (first pids))
+               (when (string? choice) ;do not attempt to launch if no choice
                                       ;was given (e.g. if Escape is pressed in
                                       ;wmenu).
                  (execl swaymsg swaymsg "exec" "--"
@@ -464,9 +459,6 @@ (define %sway-default-keybindings
     ($mod+minus . "scratchpad show")
     ($mod+r . "mode \"resize\"")))
 
-(define %sway-default-status-command
-  "while date +'%Y-%m-%d %X'; do sleep 1; done")
-
 (define %sway-default-startup-programs
   (list
    #~(string-append
@@ -751,7 +743,7 @@ (define (sway-configuration->file conf)
     (computed-file
      "sway-config"
      #~(begin
-         (use-modules (ice-9 format) (ice-9 popen) (ice-9 match)
+         (use-modules (ice-9 format) (ice-9 match) 
                       (srfi srfi-1))
 
          (call-with-output-file #$output
@@ -859,7 +851,7 @@ (define (sway-configuration->file conf)
 
 
 ;;;
-;;; Definition of th Home Service.
+;;; Definition of the Home Service.
 ;;;
 
 (define (sway-configuration->files sway-conf)

-- 
2.45.2

I also reindented the commit message and put a line break because the
last line did not fit on my terminal.

Thank you greatly!

Regards,
Florian