Good evening comrades! "pelzflorian (Florian Pelz)" <pelzflor...@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 <pelzflor...@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’.