From 54b0b2a8b29a797932bf9a65c7f2e3981a630425 Mon Sep 17 00:00:00 2001 From: nee Date: Sat, 5 Jan 2019 23:43:42 +0100 Subject: [PATCH] services: Init the keyboard-layout in xorg-configuration-directory. * doc/guix.texi (X Window): Document keyboard-layout and keyboard-variant for xorg-start-command. Remove the example about setting the keyboard-layout through extra-config. * gnu/services/xorg.scm (xorg-configuration-file): Add keyboard-layout and keyboard-variant arguments. * gnu/system/examples/desktop.tmpl: Add keyboard-layout and keyboard-variant for xorg. * gnu/system/examples/lightweight-desktop.tmpl: Add keyboard-layout and keyboard-variant for xorg. --- doc/guix.texi | 69 +++++--------------- gnu/services/xorg.scm | 25 +++++-- gnu/system/examples/desktop.tmpl | 13 +++- gnu/system/examples/lightweight-desktop.tmpl | 13 +++- 4 files changed, 60 insertions(+), 60 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f86a2885a..2a915c07d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -48,7 +48,7 @@ Copyright @copyright{} 2017, 2018 Tobias Geerinckx-Rice@* Copyright @copyright{} 2017 George Clemmer@* Copyright @copyright{} 2017 Andy Wingo@* Copyright @copyright{} 2017, 2018 Arun Isaac@* -Copyright @copyright{} 2017 nee@* +Copyright @copyright{} 2017, 2019 nee@* Copyright @copyright{} 2018 Rutger Helling@* Copyright @copyright{} 2018 Oleg Pykhalov@* Copyright @copyright{} 2018 Mike Gerwitz@* @@ -1004,7 +1004,7 @@ similar file. It can be converted to the OpenSSH format using @command{lsh-export-key} (@pxref{Converting keys,,, lsh, LSH Manual}): @example -$ lsh-export-key --openssh < /etc/lsh/host-key.pub +$ lsh-export-key --openssh < /etc/lsh/host-key.pub ssh-rsa AAAAB3NzaC1yc2EAAAAEOp8FoQAAAQEAs1eB46LV@dots{} @end example @@ -2807,13 +2807,13 @@ produced by @command{guix pull}, along with details about their provenance: @example $ guix pull -l -Generation 1 Jun 10 2018 00:18:18 +Generation 1 Jun 10 2018 00:18:18 guix 65956ad repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master commit: 65956ad3526ba09e1f7a40722c96c6ef7c0936fe -Generation 2 Jun 11 2018 11:02:49 +Generation 2 Jun 11 2018 11:02:49 guix e0cc7f6 repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master @@ -2823,7 +2823,7 @@ Generation 2 Jun 11 2018 11:02:49 guile2.0-guix@@0.14.0-12.77a1aac, guix@@0.14.0-12.77a1aac, heimdal@@7.5.0, milkytracker@@1.02.00, nix@@2.0.4 -Generation 3 Jun 13 2018 23:31:07 (current) +Generation 3 Jun 13 2018 23:31:07 (current) guix 844cc1c repository URL: https://git.savannah.gnu.org/git/guix.git branch: origin/master @@ -3018,7 +3018,7 @@ modules: @example $ guix pull --list-generations @dots{} -Generation 19 Aug 27 2018 16:20:48 +Generation 19 Aug 27 2018 16:20:48 guix d894ab8 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master @@ -3255,7 +3255,7 @@ and commit IDs (@pxref{Channels}): @example $ guix describe -Generation 10 Sep 03 2018 17:32:44 (current) +Generation 10 Sep 03 2018 17:32:44 (current) guix e0fa68c repository URL: https://git.savannah.gnu.org/git/guix.git branch: master @@ -4342,9 +4342,9 @@ build file @file{build.xml} with tasks to build the specified jar archive. In this case the parameter @code{#:source-dir} can be used to specify the source sub-directory, defaulting to ``src''. -The @code{#:main-class} parameter can be used with the minimal ant -buildfile to specify the main class of the resulting jar. This makes the -jar file executable. The @code{#:test-include} parameter can be used to +The @code{#:main-class} parameter can be used with the minimal ant +buildfile to specify the main class of the resulting jar. This makes the +jar file executable. The @code{#:test-include} parameter can be used to specify the list of junit tests to run. It defaults to @code{(list "**/*Test.java")}. The @code{#:test-exclude} can be used to disable some tests. It defaults to @code{(list "**/Abstract*.java")}, @@ -12949,12 +12949,15 @@ type @code{}. @deffn {Scheme Procedure} xorg-start-command [#:guile] @ [#:modules %default-xorg-modules] @ [#:fonts %default-xorg-fonts] @ + [#:keyboard-layout "us"] @ + [#:keyboard-variant #f] @ [#:configuration-file (xorg-configuration-file @dots{})] @ [#:xorg-server @var{xorg-server}] Return a @code{startx} script in which @var{modules}, a list of X module -packages, and @var{fonts}, a list of X font directories, are available. See -@code{xorg-wrapper} for more details on the arguments. The result should be -used in place of @code{startx}. +packages, and @var{fonts}, a list of X font directories, are available. +It will use the @var{keyboard-layout} with the @var{keyboard-variant} +if it exists in @var{xkeyboard-config}. See @code{xorg-wrapper} for more +details on the arguments. The result should be used in place of @code{startx}. Usually the X server is started by a login manager. @end deffn @@ -12982,44 +12985,6 @@ resolutions---e.g., @code{((1024 768) (640 480))}. Last, @var{extra-config} is a list of strings or objects appended to the configuration file. It is used to pass extra text to be added verbatim to the configuration file. - -@cindex keymap -@cindex keyboard layout -This procedure is especially useful to configure a different keyboard layout -than the default US keymap. For instance, to use the ``bépo'' keymap by -default on the display manager: - -@example -(define bepo-evdev - "Section \"InputClass\" - Identifier \"evdev keyboard catchall\" - Driver \"evdev\" - MatchIsKeyboard \"on\" - Option \"xkb_layout\" \"fr\" - Option \"xkb_variant\" \"bepo\" -EndSection") - -(operating-system - ... - (services - (modify-services %desktop-services - (slim-service-type config => - (slim-configuration - (inherit config) - (startx (xorg-start-command - #:configuration-file - (xorg-configuration-file - #:extra-config - (list bepo-evdev))))))))) -@end example - -The @code{MatchIsKeyboard} line specifies that we only apply the configuration -to keyboards. Without this line, other devices such as touchpad may not work -correctly because they will be attached to the wrong driver. In this example, -the user typically used @code{setxkbmap fr bepo} to set their favorite keymap -once logged in. The first argument corresponds to the layout, while the second -argument corresponds to the variant. The @code{xkb_variant} line can be omitted -to select the default variant. @end deffn @deffn {Scheme Procedure} screen-locker-service @var{package} [@var{program}] @@ -22727,7 +22692,7 @@ extends: shepherd-root description: Install the given fonts on the specified ttys (fonts are + per virtual console on GNU/Linux). The value of this service is a list + of tty/font pairs like: -+ ++ + '(("tty1" . "LatGrkCyr-8x16")) relevance: 20 diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index ea8433af3..f41c5dfe8 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017 Andy Wingo ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2015 Sou Bunnbu +;;; Copyright © 2019 nee ;;; ;;; This file is part of GNU Guix. ;;; @@ -121,6 +122,8 @@ (modules %default-xorg-modules) (fonts %default-xorg-fonts) (drivers '()) (resolutions '()) + (keyboard-layout #f) + (keyboard-variant #f) (extra-config '())) "Return a configuration file for the Xorg server containing search paths for all the common drivers. @@ -222,6 +225,21 @@ EndSection\n" port) port) (newline port) + (when #$keyboard-layout + (display "Section \"InputClass\" + Identifier \"evdev keyboard catchall\" + MatchIsKeyboard \"on\"\n" port) + (format port + " Option \"XkbLayout\" ~s\n" #$keyboard-layout) + (when #$keyboard-variant + (format + port + " Option \"XkbVariant\" ~s\n" #$keyboard-variant)) + (display + " MatchDevicePath \"/dev/input/event*\" + Driver \"evdev\" +EndSection\n" port)) + (for-each (lambda (config) (display config port)) '#$extra-config))))) @@ -229,7 +247,7 @@ EndSection\n" port) (computed-file "xserver.conf" build)) -(define (xorg-configuration-directory modules) +(define* (xorg-configuration-directory modules) "Return a directory that contains the @code{.conf} files for X.org that includes the @code{share/X11/xorg.conf.d} directories of each package listed in @var{modules}." @@ -255,6 +273,7 @@ in @var{modules}." files) #t)))) + (define* (xorg-wrapper #:key (guile (canonical-package guile-2.0)) (modules %default-xorg-modules) @@ -290,9 +309,7 @@ in place of @code{/usr/bin/X}." #:fonts fonts)) (xorg-server xorg-server)) "Return a @code{startx} script in which @var{modules}, a list of X module -packages, and @var{fonts}, a list of X font directories, are available. See -@code{xorg-wrapper} for more details on the arguments. The result should be -used in place of @code{startx}." +packages, and @var{fonts}, a list of X font directories, are available." (define X (xorg-wrapper #:guile guile #:configuration-file configuration-file diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index 1b8d46afa..cb561c4e5 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -3,7 +3,7 @@ ;; root partition is encrypted with LUKS. (use-modules (gnu) (gnu system nss)) -(use-service-modules desktop) +(use-service-modules desktop xorg) (use-package-modules certs gnome) (operating-system @@ -52,7 +52,16 @@ ;; NetworkManager, and more. (services (cons* (gnome-desktop-service) (xfce-desktop-service) - %desktop-services)) + (modify-services %desktop-services + (slim-service-type config => + (slim-configuration + (inherit config) + (startx + (xorg-start-command + #:configuration-file + (xorg-configuration-file + #:keyboard-layout "us" + #:keyboard-variant #f)))))))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index 360ee62ff..c5ca4a3db 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl @@ -3,7 +3,7 @@ ;; environments. (use-modules (gnu) (gnu system nss)) -(use-service-modules desktop) +(use-service-modules desktop xorg) (use-package-modules bootloaders certs ratpoison suckless wm) (operating-system @@ -46,7 +46,16 @@ ;; Use the "desktop" services, which include the X11 ;; log-in service, networking with NetworkManager, and more. - (services %desktop-services) + (services (modify-services %desktop-services + (slim-service-type config => + (slim-configuration + (inherit config) + (startx + (xorg-start-command + #:configuration-file + (xorg-configuration-file + #:keyboard-layout "us" + #:keyboard-variant #f))))))) ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) -- 2.20.1