installer: keymap: Put English layout and international variant ahead.
* gnu/installer/newt/keymap.scm (sort-layouts): New procedure, (sort-variants): new procedure, (run-keymap-page): use the two procedures above to sort layouts and variants.
This commit is contained in:
parent
513914b59f
commit
cb614af011
@ -24,6 +24,7 @@
|
|||||||
#:use-module (guix records)
|
#:use-module (guix records)
|
||||||
#:use-module (newt)
|
#:use-module (newt)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (srfi srfi-34)
|
#:use-module (srfi srfi-34)
|
||||||
#:use-module (srfi srfi-35)
|
#:use-module (srfi srfi-35)
|
||||||
#:export (run-keymap-page))
|
#:export (run-keymap-page))
|
||||||
@ -35,6 +36,7 @@
|
|||||||
#:info-text (G_ "Please choose your keyboard layout.")
|
#:info-text (G_ "Please choose your keyboard layout.")
|
||||||
#:listbox-items layouts
|
#:listbox-items layouts
|
||||||
#:listbox-item->text layout->text
|
#:listbox-item->text layout->text
|
||||||
|
#:sort-listbox-items? #f
|
||||||
#:button-text (G_ "Exit")
|
#:button-text (G_ "Exit")
|
||||||
#:button-callback-procedure
|
#:button-callback-procedure
|
||||||
(lambda _
|
(lambda _
|
||||||
@ -49,6 +51,7 @@
|
|||||||
#:info-text (G_ "Please choose a variant for your keyboard layout.")
|
#:info-text (G_ "Please choose a variant for your keyboard layout.")
|
||||||
#:listbox-items variants
|
#:listbox-items variants
|
||||||
#:listbox-item->text variant->text
|
#:listbox-item->text variant->text
|
||||||
|
#:sort-listbox-items? #f
|
||||||
#:button-text (G_ "Back")
|
#:button-text (G_ "Back")
|
||||||
#:button-callback-procedure
|
#:button-callback-procedure
|
||||||
(lambda _
|
(lambda _
|
||||||
@ -56,6 +59,28 @@
|
|||||||
(condition
|
(condition
|
||||||
(&installer-step-abort)))))))
|
(&installer-step-abort)))))))
|
||||||
|
|
||||||
|
(define (sort-layouts layouts)
|
||||||
|
"Sort LAYOUTS list by putting the US layout ahead and return it."
|
||||||
|
(call-with-values
|
||||||
|
(lambda ()
|
||||||
|
(partition
|
||||||
|
(lambda (layout)
|
||||||
|
(let ((name (x11-keymap-layout-name layout)))
|
||||||
|
(string=? name "us")))
|
||||||
|
layouts))
|
||||||
|
(cut append <> <>)))
|
||||||
|
|
||||||
|
(define (sort-variants variants)
|
||||||
|
"Sort VARIANTS list by putting the internation variant ahead and return it."
|
||||||
|
(call-with-values
|
||||||
|
(lambda ()
|
||||||
|
(partition
|
||||||
|
(lambda (variant)
|
||||||
|
(let ((name (x11-keymap-variant-name variant)))
|
||||||
|
(string=? name "altgr-intl")))
|
||||||
|
variants))
|
||||||
|
(cut append <> <>)))
|
||||||
|
|
||||||
(define* (run-keymap-page layouts)
|
(define* (run-keymap-page layouts)
|
||||||
"Run a page asking the user to select a keyboard layout and variant. LAYOUTS
|
"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
|
is a list of supported X11-KEYMAP-LAYOUT. Return a list of two elements, the
|
||||||
@ -67,7 +92,7 @@ names of the selected keyboard layout and variant."
|
|||||||
(compute
|
(compute
|
||||||
(lambda _
|
(lambda _
|
||||||
(run-layout-page
|
(run-layout-page
|
||||||
layouts
|
(sort-layouts layouts)
|
||||||
(lambda (layout)
|
(lambda (layout)
|
||||||
(x11-keymap-layout-description layout))))))
|
(x11-keymap-layout-description layout))))))
|
||||||
;; Propose the user to select a variant among those supported by the
|
;; Propose the user to select a variant among those supported by the
|
||||||
@ -80,10 +105,11 @@ names of the selected keyboard layout and variant."
|
|||||||
(variants (x11-keymap-layout-variants layout)))
|
(variants (x11-keymap-layout-variants layout)))
|
||||||
;; Return #f if the layout does not have any variant.
|
;; Return #f if the layout does not have any variant.
|
||||||
(and (not (null? variants))
|
(and (not (null? variants))
|
||||||
(run-variant-page variants
|
(run-variant-page
|
||||||
(lambda (variant)
|
(sort-variants variants)
|
||||||
(x11-keymap-variant-description
|
(lambda (variant)
|
||||||
variant))))))))))
|
(x11-keymap-variant-description
|
||||||
|
variant))))))))))
|
||||||
|
|
||||||
(define (format-result result)
|
(define (format-result result)
|
||||||
(let ((layout (x11-keymap-layout-name
|
(let ((layout (x11-keymap-layout-name
|
||||||
|
Loading…
Reference in New Issue
Block a user