aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Pelz <pelzflorian@pelzflorian.de>2020-04-09 02:38:27 +0200
committerFlorian Pelz <pelzflorian@pelzflorian.de>2020-04-09 03:45:22 +0000
commit7bc71025ccd0fabd739803889825e10341fbabdf (patch)
tree5aa14b90f522650a278afafa5a132b2b69a16b04
parent91c231a2223440081426929828a23c7baa0214fd (diff)
downloadguix-7bc71025ccd0fabd739803889825e10341fbabdf.tar
guix-7bc71025ccd0fabd739803889825e10341fbabdf.tar.gz
installer: Include empty variant in keyboard layout selection.
Previously for Azerbaijani, no Latin layout but only the Cyrillic variant could be selected. * gnu/installer/newt/keymap.scm (add-empty-variant): New procedure. (run-keymap-page): Use it to insert an empty variant.
-rw-r--r--gnu/installer/newt/keymap.scm21
1 files changed, 16 insertions, 5 deletions
diff --git a/gnu/installer/newt/keymap.scm b/gnu/installer/newt/keymap.scm
index a555a1ecc1..1b3af2f158 100644
--- a/gnu/installer/newt/keymap.scm
+++ b/gnu/installer/newt/keymap.scm
@@ -104,14 +104,21 @@ different layout at any time from the parameters menu.")))
(append (sort main layout<?)
(sort others layout<?)))))
+(define (add-empty-variant variants)
+ "Prepend #f to VARIANTS so the user has the option to select no variant.
+The resulting layout may be different from all other variants (e.g. for
+Azerbaijani)."
+ (cons #f variants))
+
(define (sort-variants variants)
"Sort VARIANTS list by putting the international variant ahead and return it."
(call-with-values
(lambda ()
(partition
(lambda (variant)
- (let ((name (x11-keymap-variant-name variant)))
- (string=? name "altgr-intl")))
+ (and variant
+ (let ((name (x11-keymap-variant-name variant)))
+ (string=? name "altgr-intl"))))
variants))
(cut append <> <>)))
@@ -180,10 +187,14 @@ options."
;; Return #f if the layout does not have any variant.
(and (not (null? variants))
(run-variant-page
- (sort-variants variants)
+ (sort-variants (add-empty-variant variants))
(lambda (variant)
- (gettext (x11-keymap-variant-description variant)
- "xkeyboard-config"))))))))))
+ (if variant
+ (gettext (x11-keymap-variant-description variant)
+ "xkeyboard-config")
+ ;; Text to opt for no variant at all:
+ (gettext (x11-keymap-layout-description layout)
+ "xkeyboard-config")))))))))))
(define (format-result result)
(let ((layout (x11-keymap-layout-name