aboutsummaryrefslogtreecommitdiff
path: root/gnu/tests.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-11-27 14:09:11 +0100
committerMarius Bakke <marius@gnu.org>2022-11-27 21:19:50 +0100
commit98de78523be8009a13a67f65e4dc3cb5e22a5cea (patch)
tree3e6940fbc309230da08252e0d1a9408269033f5c /gnu/tests.scm
parent8c9656bc2f697f09cc9583537108efd9313362e7 (diff)
downloadguix-98de78523be8009a13a67f65e4dc3cb5e22a5cea.tar.gz
guix-98de78523be8009a13a67f65e4dc3cb5e22a5cea.zip
gnu: libxkbcommon: Fix cross-compilation.
* gnu/packages/xdisorg.scm (libxkbcommon)[native-inputs]: When cross-compiling, add PKG-CONFIG-FOR-BUILD and WAYLAND.
Diffstat (limited to 'gnu/tests.scm')
0 files changed, 0 insertions, 0 deletions
t<?) (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) (and variant (let ((name (x11-keymap-variant-name variant))) (string=? name "altgr-intl")))) variants)) (cut append <> <>))) (define %non-latin-layouts ;; List of keyboard layouts marked as $nonlatin in xkeyboard-config. ;; See comments in xkeyboard-config file /share/X11/xkb/rules/base. ;; We ignore layouts that support Latin input: "kr" '("am" "ara" "ben" "bd" "bg" "bt" "by" "cs" "deva" "ge" "gh" "gr" "guj" "guru" "il" "in" "ir" "iku" "jp" "kan" "kh" "la" "lao" "lk" "mk" "mm" "mn" "mv" "mal" "olck" "ori" "pk" "ru" "scc" "sy" "syr" "tel" "th" "tj" "tam" "ua" "uz" ;; The list from xkeyboard-config is incomplete. Add more layouts when ;; noticed: "et" "kz")) (define %non-latin-variants '("cyrillic")) (define %latin-layout+variants ;; These layout+variant combinations are Latin after all. '(("ir" "ku"))) (define (toggleable-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 (and (not (equal? variant "latin")) (not (member (list layout variant) %latin-layout+variants)) (or (member layout %non-latin-layouts) (member variant %non-latin-variants))) (let ((latin-layout (if (equal? variant "azerty") "fr" "us"))) (list (string-append layout "," latin-layout) ;; Comma to use variant only for non-Latin: (and variant (string-append variant ",")) "grp:alt_shift_toggle")) (list layout variant #f))) (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. 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 options." (define keymap-steps (list (installer-step (id 'layout) (compute (lambda _ (run-layout-page (sort-layouts layouts) (lambda (layout) (gettext (x11-keymap-layout-description layout) "xkeyboard-config")) context)))) ;; Propose the user to select a variant among those supported by the ;; previously selected layout. (installer-step (id 'variant) (compute (lambda (result _) (let* ((layout (result-step result 'layout)) (variants (if layout (x11-keymap-layout-variants layout) '()))) ;; Return #f if the layout does not have any variant. (and (not (null? variants)) (run-variant-page (sort-variants (add-empty-variant variants)) (lambda (variant) (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 layout variant) (let ((layout (x11-keymap-layout-name layout)) (variant (and=> variant (lambda (variant) (gettext (x11-keymap-variant-name variant) "xkeyboard-config"))))) (toggleable-latin-layout layout variant))) (let* ((result (run-installer-steps #:steps keymap-steps)) (layout (result-step result 'layout)) (variant (result-step result 'variant))) (and layout (format-result layout variant)))) (define (keyboard-layout->configuration keymap) "Return the operating system configuration snippet to install KEYMAP." (match keymap ((name #f "grp:alt_shift_toggle") `((keyboard-layout (keyboard-layout ,name #:options '("grp:alt_shift_toggle"))))) ((name #f _) `((keyboard-layout (keyboard-layout ,name)))) ((name variant "grp:alt_shift_toggle") `((keyboard-layout (keyboard-layout ,name ,variant #:options '("grp:alt_shift_toggle"))))) ((name variant _) `((keyboard-layout (keyboard-layout ,name ,variant))))))