Subject: Re: [bug#47994] [PATCH] services: kmscon: Add xkb-layout and xkb-options fields.

From: Maxime Devos <[email-masked]>
Date: Sun, 25 Apr 2021 14:46:25 +0200

luhui schreef op zo 25-04-2021 om 18:04 [+0800]:
> +@item @code{xkb-layout} (default: @code{#f})
> +When true, this field be a string used for set keyboard layout used in Kmscon.
> +See the @code{xkeyboard-config} package for valid layouts.
> +
> +@item @code{xkb-options} (default: @code{#f})
> +When true, this field be a string used for set keyboard layout options used in
> +Kmscon. See the @code{xkeyboard-config} package for valid options.

I looked in the guix manual for ideas how to formulate this clearer.
The section ‘10.6 Keyboard layout’ (<https://guix.gnu.org/manual/en/html_node/Keyboard-Layout.html#Keyboard-Layout>)
seems interesting, in particualr the "keyboard-layout" procedure from (gnu system keyboard).
It seemed a nicer abstraction than just raw strings.

An extract from the manual:

   Keyboard layouts are represented by records created by the
‘keyboard-layout’ procedure of ‘(gnu system keyboard)’.  Following the X
Keyboard extension (XKB), each layout has four attributes: a name (often
a language code such as “fi” for Finnish or “jp” for Japanese), an
optional variant name, an optional keyboard model name, and a possibly
empty list of additional options.  In most cases the layout name is all
you care about.

 -- Scheme Procedure: keyboard-layout NAME [VARIANT] [#:model]
          [#:options '()]
     Return a new keyboard layout with the given NAME and VARIANT.

     NAME must be a string such as ‘"fr"’; VARIANT must be a string such
     as ‘"bepo"’ or ‘"nodeadkeys"’.  See the ‘xkeyboard-config’ package
     for valid options.

   Here are a few examples:

     ;; The German QWERTZ layout.  Here we assume a standard
     ;; "pc105" keyboard model.
     (keyboard-layout "de")

     ;; The bépo variant of the French layout.
     (keyboard-layout "fr" "bepo")

Could this be used instead of raw strings?

> +When true, this field be a string used for set keyboard layout used in Kmscon.

When true, this field is a string representing the name of the keyboard layout.
Suggested documentation (based on the xorg-configuration documentation):

@item @code{keboard-layout} (default: @code{#f})
If this is false, Kmscon uses the default keyboard layout.

Otherwise this must be a field is a ‘keyboard layout’ object specifying
the keyboard layout to use for the console.   *Note
          Keyboard Layout::, for more information on how to specify the
keyboard layout.

Greetings,
Maxime.