summary refs log tree commit diff
path: root/gnu/installer/keymap.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <m.othacehe@gmail.com>2018-12-05 21:53:40 +0900
committerLudovic Courtès <ludo@gnu.org>2019-01-17 14:04:25 +0100
commit479414e1c9e13ddce9e0c8741eb9f50dff62e333 (patch)
tree3eb13e55767aca4a970d3200c2a8ef6043db43f5 /gnu/installer/keymap.scm
parent7d812901daf0259d5d381199168d6d2994ce00ac (diff)
downloadguix-479414e1c9e13ddce9e0c8741eb9f50dff62e333.tar.gz
installer: keymap: Do not fail on non-kmscon terminals.
kmscon-update-keymap fails on non kmscon terminals because KEYMAP_UPDATE
environment variable is not defined. As it is convenient to test the installer
on a regular terminal, do nothing if KEYMAP_UPDATE is missing.

* gnu/installer/keymap.scm (kmscon-update-keymap): Do nothing if KEYMAP_UPDATE
is not defined.
Diffstat (limited to 'gnu/installer/keymap.scm')
-rw-r--r--gnu/installer/keymap.scm36
1 files changed, 21 insertions, 15 deletions
diff --git a/gnu/installer/keymap.scm b/gnu/installer/keymap.scm
index d9f8656855..d66b376d9c 100644
--- a/gnu/installer/keymap.scm
+++ b/gnu/installer/keymap.scm
@@ -149,18 +149,24 @@ Configuration Database, describing possible XKB configurations."
        (values models layouts)))))
 
 (define (kmscon-update-keymap model layout variant)
-  (let ((keymap-file (getenv "KEYMAP_UPDATE")))
-    (unless (and keymap-file
-                 (file-exists? keymap-file))
-      (error "Unable to locate keymap update file"))
-
-    (call-with-output-file keymap-file
-        (lambda (port)
-          (format port model)
-          (put-u8 port 0)
-
-          (format port layout)
-          (put-u8 port 0)
-
-          (format port variant)
-          (put-u8 port 0)))))
+  "Update kmscon keymap with the provided MODEL, LAYOUT and VARIANT."
+  (and=>
+   (getenv "KEYMAP_UPDATE")
+   (lambda (keymap-file)
+     (unless (file-exists? keymap-file)
+       (error "Unable to locate keymap update file"))
+
+     ;; See file gnu/packages/patches/kmscon-runtime-keymap-switch.patch.
+     ;; This dirty hack makes possible to update kmscon keymap at runtime by
+     ;; writing an X11 keyboard model, layout and variant to a named pipe
+     ;; referred by KEYMAP_UPDATE environment variable.
+     (call-with-output-file keymap-file
+       (lambda (port)
+         (format port model)
+         (put-u8 port 0)
+
+         (format port layout)
+         (put-u8 port 0)
+
+         (format port variant)
+         (put-u8 port 0))))))