From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#40493: installer: Provide a way to select multiple keyboard layouts Date: Tue, 07 Apr 2020 22:38:16 +0200 Message-ID: <87wo6r6ngn.fsf@gnu.org> References: <87369fmd8d.fsf@gmail.com> <20200407175002.uzjqzm7fdgxftrrn@pelzflorian.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58841) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLuzv-0004Sk-5C for bug-guix@gnu.org; Tue, 07 Apr 2020 16:39:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLuzt-00066c-UJ for bug-guix@gnu.org; Tue, 07 Apr 2020 16:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39527) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLuzt-00066W-Ra for bug-guix@gnu.org; Tue, 07 Apr 2020 16:39:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jLuzt-00047C-Ox for bug-guix@gnu.org; Tue, 07 Apr 2020 16:39:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20200407175002.uzjqzm7fdgxftrrn@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Tue, 7 Apr 2020 19:50:02 +0200") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane-mx.org@gnu.org Sender: "bug-Guix" To: "pelzflorian (Florian Pelz)" Cc: 40493@debbugs.gnu.org Good evening comrades! "pelzflorian (Florian Pelz)" 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 > Date: Tue, 7 Apr 2020 19:06:31 +0200 > Subject: [PATCH] installer: Allow Alt+Shift toggle from non-Latin keyboard > layouts. > > See . > > * gnu/installer/newt/keymap.scm (run-keymap-page): Maybe add second layou= t. > * gnu/installer/keymap.scm (kmscon-update-keymap): Pass on XKB options. > * gnu/installer/records.scm (): 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 opti= ons. 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. L= AYOUTS > -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 layout= s, 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 =E2=80=9CControl=E2=80=9D key. :-) > + (define (maybe-add-second-layout first-layout) > + "Return for a chosen keyboard layout either the same layout or possi= bly > +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" =E2=80=A6)) =E2=80=A6)) ? Eventually we can replace =E2=80=98member=E2=80=99 or =E2=80=98match=E2=80= =99 with something more fancy, assuming the xkeyboard-config databases contain the relevant info (=E2=80=98base.xml=E2=80=99 doesn=E2=80=99t say what=E2=80=99s Latin and wh= at=E2=80=99s not apparently.) > + (match first-layout > + (("ar" "azerty") (list "ar,fr" "azerty," "grp:alt_shift_toggle")) ^ Remove comma? Thank you! Ludo=E2=80=99.