GNU bug report logs - #40493
installer: Provide a way to select multiple keyboard layouts

Previous Next

Package: guix;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Tue, 7 Apr 2020 17:13:19 UTC

Severity: normal

Done: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 40493 in the body.
You can then email your comments to 40493 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Tue, 07 Apr 2020 17:13:24 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 07 Apr 2020 17:13:25 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: bug-guix <at> gnu.org
Cc: pelzflorian <at> pelzflorian.de
Subject: installer: Provide a way to select multiple keyboard layouts
Date: Tue, 07 Apr 2020 19:12:34 +0200
Hello,

The installer gained support for keyboard layout switching from every
step recently[1].

It is also possible with commit 2729cb406d9f3e9eb22cc660f887138134edb3a8
to specify comma-separated keyboard layouts, this way:

--8<---------------cut here---------------start------------->8---
(keyboard-layout "ar,us" #:options '("grp:alt_shift_toggle"))
--8<---------------cut here---------------end--------------->8---

Now it would be nice to support multiple keyboard layout selection from
the installer, so that a configuration like to one above is generated.

Thanks,

Mathieu

[1]: https://lists.gnu.org/archive/html/bug-guix/2020-03/msg00381.html 




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Tue, 07 Apr 2020 17:52:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: bug-guix <at> gnu.org
Subject: Re: installer: Provide a way to select multiple keyboard layouts
Date: Tue, 7 Apr 2020 19:50:02 +0200
[Message part 1 (text/plain, inline)]
On Tue, Apr 07, 2020 at 07:12:34PM +0200, Mathieu Othacehe wrote:
> Now it would be nice to support multiple keyboard layout selection from
> the installer, so that a configuration like to one above is generated.
> 
> Thanks,
> 
> Mathieu

Ludo responded to the other bug:

On Tue, Apr 07, 2020 at 11:49:09AM +0200, Ludovic Courtès wrote:
> Ideally we’d also offer a way to choose multiple layouts in the
> installer, so that one can end up with:
>
>   (keyboard-layout "ar,us" #:options '("grp:alt_shift_toggle"))
>

I believe the user should not have to manually select the other layout
(if the user wants they can select via F1 key).  Instead there should
be a sane default (typically U.S. layout).  But since I am used to
Latin script, I may not have good judgment.

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.

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

Both the config.scm default and the installer layout should be the
same, I think.

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.

> Although that’s mostly useful for the console as GDM and GNOME should be
> able to do the right thing.
> 
> Anyway, we can discuss it in a separate issue.
> 
> Ludo’.

The GNOME session after login will ask the user what keyboard layout
they want, but the (I believe changeable) default for GDM comes
from config.scm.

Regards,
Florian
[0001-installer-Allow-Alt-Shift-toggle-from-non-Latin-keyb.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Tue, 07 Apr 2020 20:39:01 GMT) Full text and rfc822 format available.

Message #11 received at 40493 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 40493 <at> debbugs.gnu.org
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Tue, 07 Apr 2020 22:38:16 +0200
Good evening comrades!

"pelzflorian (Florian Pelz)" <pelzflorian <at> 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 <at> 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’.




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Tue, 07 Apr 2020 21:57:01 GMT) Full text and rfc822 format available.

Message #14 received at 40493 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 40493 <at> debbugs.gnu.org
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Tue, 7 Apr 2020 23:56:53 +0200
On Tue, Apr 07, 2020 at 10:38:16PM +0200, Ludovic Courtès wrote:
> Overall LGTM!  Minor suggestion below:

I will make a new patch tonight and follow your suggestions.  Thank you!

The layout toggling worked fine btw, except Arabic layout is called
"ara" and not "ar" in base.xml …

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Wed, 08 Apr 2020 09:59:01 GMT) Full text and rfc822 format available.

Message #17 received at 40493 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 40493 <at> debbugs.gnu.org
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Wed, 8 Apr 2020 11:58:12 +0200
[Message part 1 (text/plain, inline)]
On Tue, Apr 07, 2020 at 10:38:16PM +0200, Ludovic Courtès wrote:
> 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.
>

I am still doing final testing, but I believe I can push the attached
patch.


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

The comma is needed, for example the Japanese Kana ("jp" "kana")
layout breaks otherwise.  I believe the reason is that the "kana"
variant gets applied to "us" layout.

Regards,
Florian
[0001-installer-Allow-Alt-Shift-toggle-from-non-Latin-keyb.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Wed, 08 Apr 2020 13:23:02 GMT) Full text and rfc822 format available.

Message #20 received at 40493 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>, 40493 <at> debbugs.gnu.org
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Wed, 08 Apr 2020 15:22:34 +0200
Hi,

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

> The comma is needed, for example the Japanese Kana ("jp" "kana")
> layout breaks otherwise.  I believe the reason is that the "kana"
> variant gets applied to "us" layout.

I see.

> From 68fc18d2816e3997f38d0a3c69566d85b26c8719 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Wed, 8 Apr 2020 11:46:16 +0200
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> Subject: [PATCH] installer: Allow Alt+Shift toggle from non-Latin keyboard
>  layouts.
>
> Fixes <https://bugs.gnu.org/40493>.
>
> * gnu/installer/newt/keymap.scm (%non-latin-layouts): New variable.
> (toggleable-latin-layout): New procedure to compute combined layouts.
> (run-keymap-page): Use it.
> (keyboard-layout->configuration): Apply it in config.scm.
> * gnu/installer/newt/help.scm (run-help-page): Mention Alt+Shift.
> * gnu/installer/keymap.scm (kmscon-update-keymap): Pass on XKB options.
> * gnu/installer/record.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.

[...]

> +(define %non-latin-layouts
> +  ;; List of keyboard layouts marked as $nonlatin in xkeyboard-config.

Out of curiosity, where did you find that info?  Perhaps add the name of
the relevant file or XML tag here.

> +      (apply toggleable-latin-layout
> +             (list layout (or variant "")))))

Simply:

  (toggleable-latin-layout layout (or variant ""))

This allows the compiler to detect a wrong number of arguments.

Go for it, thank you!

Ludo’.




Reply sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
You have taken responsibility. (Thu, 09 Apr 2020 04:15:01 GMT) Full text and rfc822 format available.

Notification sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
bug acknowledged by developer. (Thu, 09 Apr 2020 04:15:02 GMT) Full text and rfc822 format available.

Message #25 received at 40493-done <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 40493-done <at> debbugs.gnu.org, Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Thu, 9 Apr 2020 06:14:11 +0200
On Wed, Apr 08, 2020 at 03:22:34PM +0200, Ludovic Courtès wrote:
> Go for it, thank you!

I added some more heuristics on whether a layout is Latin or not and
after much testing pushed as 91c231a2223440081426929828a23c7baa0214fd.
There are still few false positives like non-Kana Japanese layouts
that are Latin but toggle to U.S.  They can be fixed later.

More importantly with 7bc71025ccd0fabd739803889825e10341fbabdf I also
fixed a layout’s empty variant "" not being a choice in the installer.
The "" variant is the only variant of the Azerbaijani layout providing
the Latin script Azerbaijan uses since a few decades, so it is
important.  I hope the code is alright; maybe I should not have just
pushed, but I believe it is alright.

Marking as done.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Thu, 09 Apr 2020 04:22:01 GMT) Full text and rfc822 format available.

Message #28 received at 40493-done <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 40493-done <at> debbugs.gnu.org
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Thu, 9 Apr 2020 06:21:37 +0200
On Thu, Apr 09, 2020 at 06:14:11AM +0200, pelzflorian (Florian Pelz) wrote:
> Marking as done.

P.S. Don’t brag with Arabic support in Guix’ installer just yet
because Arabs still have to confusedly read from left to right.

https://bugs.gnu.org/35319

But that is something to solve later.




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Thu, 09 Apr 2020 07:27:01 GMT) Full text and rfc822 format available.

Message #31 received at 40493-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 40493-done <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Thu, 09 Apr 2020 09:25:58 +0200
Hello Florian,

> I added some more heuristics on whether a layout is Latin or not and
> after much testing pushed as 91c231a2223440081426929828a23c7baa0214fd.
> There are still few false positives like non-Kana Japanese layouts
> that are Latin but toggle to U.S.  They can be fixed later.

Nice! Thanks for taking care of this :)

In the future it would be nice to be able to extract %non-latin-layout
by parsing the base file in xkeyboard-config, rather than by maintaining
this list, but that's a minor point, and I guess new keyboard layouts
are not coming out every day :p

Mathieu




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Thu, 09 Apr 2020 07:37:01 GMT) Full text and rfc822 format available.

Message #34 received at 40493-done <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 40493-done <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Thu, 9 Apr 2020 09:36:21 +0200
On Thu, Apr 09, 2020 at 09:25:58AM +0200, Mathieu Othacehe wrote:
> Nice! Thanks for taking care of this :)
> 

:)

> In the future it would be nice to be able to extract %non-latin-layout
> by parsing the base file in xkeyboard-config, rather than by maintaining
> this list, but that's a minor point, and I guess new keyboard layouts
> are not coming out every day :p

Yes, but the source in
/gnu/store/wsykijz9a1p7gx3z8hlmn58v5f5bswp7-xkeyboard-config-2.29/share/X11/xkb/rules/base
looks like this:

// If you want non-latin layouts implicitly include the en_US layout
// uncomment lines below
//! $nonlatin = am ara ben bd bg bt by cs deva ge gh gr guj guru il \
//              in ir iku jp kan kh kr la lao lk mk mm mn mv mal olck \
//              ori pk ru scc sy syr tel th tj tam ua uz

I am not sure if parsing that (and filtering out "kr") is worth it.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Thu, 09 Apr 2020 07:56:01 GMT) Full text and rfc822 format available.

Message #37 received at 40493-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 40493-done <at> debbugs.gnu.org, Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Thu, 09 Apr 2020 09:54:54 +0200
Hi Florian,

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

> On Wed, Apr 08, 2020 at 03:22:34PM +0200, Ludovic Courtès wrote:
>> Go for it, thank you!
>
> I added some more heuristics on whether a layout is Latin or not and
> after much testing pushed as 91c231a2223440081426929828a23c7baa0214fd.
> There are still few false positives like non-Kana Japanese layouts
> that are Latin but toggle to U.S.  They can be fixed later.

Awesome!

> More importantly with 7bc71025ccd0fabd739803889825e10341fbabdf I also
> fixed a layout’s empty variant "" not being a choice in the installer.
> The "" variant is the only variant of the Azerbaijani layout providing
> the Latin script Azerbaijan uses since a few decades, so it is
> important.  I hope the code is alright; maybe I should not have just
> pushed, but I believe it is alright.

Good, it’s great you’re paying close attention to this.  The patch seems
reasonable to me.

> P.S. Don’t brag with Arabic support in Guix’ installer just yet
> because Arabs still have to confusedly read from left to right.
>
> https://bugs.gnu.org/35319
>
> But that is something to solve later.

Yeah.

I’ll run the “gui-installed” tests to make sure everything’s is still
fine, then run “make release” and upload files for testing later today.

Thanks a lot, Florian!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#40493; Package guix. (Thu, 09 Apr 2020 15:25:02 GMT) Full text and rfc822 format available.

Message #40 received at 40493-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 40493-done <at> debbugs.gnu.org, Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: Re: bug#40493: installer: Provide a way to select multiple keyboard
 layouts
Date: Thu, 09 Apr 2020 17:24:48 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> On Thu, Apr 09, 2020 at 09:25:58AM +0200, Mathieu Othacehe wrote:

[...]

>> In the future it would be nice to be able to extract %non-latin-layout
>> by parsing the base file in xkeyboard-config, rather than by maintaining
>> this list, but that's a minor point, and I guess new keyboard layouts
>> are not coming out every day :p
>
> Yes, but the source in
> /gnu/store/wsykijz9a1p7gx3z8hlmn58v5f5bswp7-xkeyboard-config-2.29/share/X11/xkb/rules/base
> looks like this:
>
> // If you want non-latin layouts implicitly include the en_US layout
> // uncomment lines below
> //! $nonlatin = am ara ben bd bg bt by cs deva ge gh gr guj guru il \
> //              in ir iku jp kan kh kr la lao lk mk mm mn mv mal olck \
> //              ori pk ru scc sy syr tel th tj tam ua uz
>
> I am not sure if parsing that (and filtering out "kr") is worth it.

Uh, agreed, it doesn’t look like something parseable.  Also, presumably
that list won’t change much over time :-), so it’s OK to have it
hard-coded in Guix IMO.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 May 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.