From fda0959a1426198f5588be691d1414807cb547cd Mon Sep 17 00:00:00 2001 From: luhui Date: Mon, 21 Jun 2021 22:58:06 +0800 Subject: services: kmscon: Add keyboard-layout fields. * gnu/services/base.scm (): Add keyboard-layout fields. * doc/guix.texi (Base Services): Document them. Signed-off-by: Mathieu Othacehe --- gnu/services/base.scm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 3be2e984c3..6922d7f90b 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2020 Florian Pelz ;;; Copyright © 2020 Brice Waegeneire ;;; Copyright © 2021 qblade +;;; Copyright © 2021 Hui Lu ;;; ;;; This file is part of GNU Guix. ;;; @@ -41,6 +42,7 @@ (define-module (gnu services base) #:use-module (gnu system shadow) ; 'user-account', etc. #:use-module (gnu system uuid) #:use-module (gnu system file-systems) ; 'file-system', etc. + #:use-module (gnu system keyboard) #:use-module (gnu system mapped-devices) #:use-module ((gnu system linux-initrd) #:select (file-system-packages)) @@ -2267,7 +2269,9 @@ (define-record-type* (font-engine kmscon-configuration-font-engine (default "pango")) (font-size kmscon-configuration-font-size - (default 12))) + (default 12)) + (keyboard-layout kmscon-configuration-keyboard-layout + (default #f))) ; #f | (define kmscon-service-type (shepherd-service-type @@ -2280,7 +2284,8 @@ (define kmscon-service-type (auto-login (kmscon-configuration-auto-login config)) (hardware-acceleration? (kmscon-configuration-hardware-acceleration? config)) (font-engine (kmscon-configuration-font-engine config)) - (font-size (kmscon-configuration-font-size config))) + (font-size (kmscon-configuration-font-size config)) + (keyboard-layout (kmscon-configuration-keyboard-layout config))) (define kmscon-command #~(list @@ -2289,6 +2294,18 @@ (define kmscon-command "--no-switchvt" ;Prevent a switch to the virtual terminal. "--font-engine" #$font-engine "--font-size" #$(number->string font-size) + #$@(if keyboard-layout + (let* ((layout (keyboard-layout-name keyboard-layout)) + (variant (keyboard-layout-variant keyboard-layout)) + (model (keyboard-layout-model keyboard-layout)) + (options (keyboard-layout-options keyboard-layout))) + `("--xkb-layout" ,layout + ,@(if variant `("--xkb-variant" ,variant) '()) + ,@(if model `("--xkb-model" ,model) '()) + ,@(if (null? options) + '() + `("--xkb-options" ,(string-join options ","))))) + '()) #$@(if hardware-acceleration? '("--hwaccel") '()) "--login" "--" #$login-program #$@login-arguments -- cgit v1.2.3