unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: 40493@debbugs.gnu.org
Subject: bug#40493: installer: Provide a way to select multiple keyboard layouts
Date: Tue, 07 Apr 2020 22:38:16 +0200	[thread overview]
Message-ID: <87wo6r6ngn.fsf@gnu.org> (raw)
In-Reply-To: <20200407175002.uzjqzm7fdgxftrrn@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Tue, 7 Apr 2020 19:50:02 +0200")

Good evening comrades!

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

> IMHO two things should be done:
>
> * Within the installer, a toggleable second keyboard layout should be
>   available by default.
>
>   Mathieu enabled changing the layout via the F1 help menu.  This is
>   good and more flexible and discoverable, but a key combination is
>   more convenient and people appear to be used to Alt+Shift toggling.

Agreed!

> * In the config.scm created by the installer, the default
>   keyboard-layout should include the second layout.

Yes.

> I attach a proposed solution for the first thing, though it does not
>   yet update the toggle option correctly.  If you think the
> approach is OK, then I will add more default alternative layouts to
> the maybe-add-second-layout procedure.

I think the approach is OK, even as-is.  We can then improve it by
(hopefully) replacing the hard-coded list of non-Latin layouts (ar, jp,
etc.) with code that determines whether the main layout is Latin or not.

> From 0d3a1ecc214fe55d77f45f4b2e690a93978da9ec Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@pelzflorian.de>
> Date: Tue, 7 Apr 2020 19:06:31 +0200
> Subject: [PATCH] installer: Allow Alt+Shift toggle from non-Latin keyboard
>  layouts.
>
> See <https://bugs.gnu.org/40273>.
>
> * gnu/installer/newt/keymap.scm (run-keymap-page): Maybe add second layout.
> * gnu/installer/keymap.scm (kmscon-update-keymap): Pass on XKB options.
> * gnu/installer/records.scm (<installer>): Adjust code comments.
> * gnu/installer.scm (apply-keymap): Pass on XKB options.
> (installer-steps): Adjust code comments.
> * gnu/packages/patches/kmscon-runtime-keymap-switch.patch: Apply XKB options.

Overall LGTM!  Minor suggestion below:

>  (define* (run-keymap-page layouts #:key (context #f))
>    "Run a page asking the user to select a keyboard layout and variant. LAYOUTS
> -is a list of supported X11-KEYMAP-LAYOUT. Return a list of two elements, the
> -names of the selected keyboard layout and variant."
> +is a list of supported X11-KEYMAP-LAYOUT.  For non-Latin keyboard layouts, a
> +second layout and toggle options will be added automatically.  Return a list
> +of three elements, the names of the selected keyboard layout, variant and
> +optionsxs."
          ^
You forgot to hold the “Control” key.  :-)

> +  (define (maybe-add-second-layout first-layout)
> +    "Return for a chosen keyboard layout either the same layout or possibly
> +the layout plus a suitable second layout, and also variant and options."

To leave room for improvement, how about making it a top-level procedure
along these lines:

  (define (switchable-latin-layout layout variant)
    "If LAYOUT is a non-Latin layout, return a new combined layout,
  a variant, and options that allow the user to switch between the
  non-Latin and the Latin layout.  Otherwise, return LAYOUT, VARIANT,
  and #f."
    (if (member layout '("ar" …))
        …))

?

Eventually we can replace ‘member’ or ‘match’ with something more fancy,
assuming the xkeyboard-config databases contain the relevant info
(‘base.xml’ doesn’t say what’s Latin and what’s not apparently.)

> +    (match first-layout
> +      (("ar" "azerty") (list "ar,fr" "azerty," "grp:alt_shift_toggle"))
                                               ^
Remove comma?

Thank you!

Ludo’.

  reply	other threads:[~2020-04-07 20:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 17:12 bug#40493: installer: Provide a way to select multiple keyboard layouts Mathieu Othacehe
2020-04-07 17:50 ` pelzflorian (Florian Pelz)
2020-04-07 20:38   ` Ludovic Courtès [this message]
2020-04-07 21:56     ` pelzflorian (Florian Pelz)
2020-04-08  9:58     ` pelzflorian (Florian Pelz)
2020-04-08 13:22       ` Ludovic Courtès
2020-04-09  4:14         ` pelzflorian (Florian Pelz)
2020-04-09  4:21           ` pelzflorian (Florian Pelz)
2020-04-09  7:25           ` Mathieu Othacehe
2020-04-09  7:36             ` pelzflorian (Florian Pelz)
2020-04-09 15:24               ` Ludovic Courtès
2020-04-09  7:54           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wo6r6ngn.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=40493@debbugs.gnu.org \
    --cc=pelzflorian@pelzflorian.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).