From mboxrd@z Thu Jan 1 00:00:00 1970 From: nee Subject: Re: Keyboard layout configuration Date: Sun, 13 Jan 2019 23:49:56 +0100 Message-ID: <6ac13233-d351-6ce5-09a2-4eb91750364f@cock.li> References: <87bm4wwrku.fsf@dismail.de> <877efktnry.fsf@elephly.net> <87imyss44u.fsf@dismail.de> <87won81bqi.fsf_-_@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------3EBD3F2B128572343FEBCAEE" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:40060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giocU-0007Sr-SV for guix-devel@gnu.org; Sun, 13 Jan 2019 17:52:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gioZv-0007az-6g for guix-devel@gnu.org; Sun, 13 Jan 2019 17:50:05 -0500 Received: from cock.li ([185.100.85.212]:50622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gioZu-0007Zb-97 for guix-devel@gnu.org; Sun, 13 Jan 2019 17:50:03 -0500 In-Reply-To: <87won81bqi.fsf_-_@gnu.org> Content-Language: en-GB List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: 25453@debbugs.gnu.org This is a multi-part message in MIME format. --------------3EBD3F2B128572343FEBCAEE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Am 13.01.19 um 22:36 schrieb Ludovic Court=C3=A8s: >> 1) grub >> 2) linux's initrd >> 3) console >> 4) X/wayland's layout >> 5) How to do the above >=20 Hello, I was working on this recently and made a patch for X11 that fixes the layout in the slim login and when you login into gnome3 or whatever desktop environment. I also made a patch for grub that fixes the layout when you edit the boot command for a menu entry, but not for the luks prompt. I think that might require installing a custom grub image (grub-mkimage) with grub-bios-setup instead of using grub-install (I saw some posts on the archlinux forum I don't have a link to right now). But this patch should lay the groundwork for it, as it can generate grub keyboard config files. The patches are pretty dirty, but I might not have that much time in the next few weeks to work on this, and since is hot on the mailing list right now, I'm sending them here now. Happy hacking! --------------3EBD3F2B128572343FEBCAEE Content-Type: text/x-patch; name="0001-bootloader-grub-custom-keyboard-layout.patch" Content-Disposition: attachment; filename="0001-bootloader-grub-custom-keyboard-layout.patch" Content-Transfer-Encoding: quoted-printable >From 5612630ea4324339322ba726846d1962aaa86dc8 Mon Sep 17 00:00:00 2001 From: nee Date: Sat, 5 Jan 2019 22:07:30 +0100 Subject: [PATCH] bootloader: grub custom keyboard-layout, but luks passwo= rd prompts are still unaffected --- gnu/bootloader/grub.scm | 128 +++++++++++++++++++++++------------ gnu/packages/bootloaders.scm | 11 +++ gnu/packages/xorg.scm | 121 +++++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+), 45 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 161e8b3d0..ca9f2f565 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -29,6 +29,7 @@ #:use-module (gnu system file-systems) #:autoload (gnu packages bootloaders) (grub) #:autoload (gnu packages gtk) (guile-cairo guile-rsvg) + #:autoload (gnu packages xorg) (xkeyboard-config) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -46,6 +47,8 @@ %background-image %default-theme =20 + grub-keyboard-layout-file + grub-bootloader grub-efi-bootloader grub-mkrescue-bootloader @@ -219,11 +222,35 @@ fi~%" ;;; Configuration file. ;;; =20 +(define* (grub-keyboard-layout-file + #:key + (layout #f) ; something like "fr" "de" "ru" + (grub grub) + (xkeyboard-config xkeyboard-config)) + "Returns a Gexp that generates a xkb keyboard LAYOUT file that GRUB ca= n load. +The LAYOUT must be present in XKEYBOARD-CONFIGs share/X11xkb/symbols/ di= rectory. +When LAYOUT is #f no file will be generated and 'no-keymap-used is +returned in a gexp." + (define builder + #~(zero? + (system* (string-append #$grub "/bin/grub-kbdcomp") + (string-append #$xkeyboard-config + "/share/X11/xkb/symbols/" #$layout) + (string-append "-I" #$xkeyboard-config + "/share/X11/xkb") + "-rules" "base" + "-o" #$output))) + + (if layout + (computed-file "keyboard-layout.xkb" builder) + (gexp 'no-keymap-used))) + + (define (grub-setup-io config) "Return GRUB commands to configure the input / output interfaces. The= result is a string that can be inserted in grub.cfg." (let* ((symbols->string (lambda (list) - (string-join (map symbol->string list) " "))) + (string-join (map symbol->string list) " "))= ) (outputs (bootloader-configuration-terminal-outputs config)) (inputs (bootloader-configuration-terminal-inputs config)) (unit (bootloader-configuration-serial-unit config)) @@ -233,41 +260,41 @@ is a string that can be inserted in grub.cfg." ;; as documented in GRUB manual section "Simple Configuration ;; Handling". (valid-outputs '(console serial serial_0 serial_1 serial_2 seri= al_3 - gfxterm vga_text mda_text morse spkmodem)) + gfxterm vga_text mda_text morse spkmod= em)) (valid-inputs '(console serial serial_0 serial_1 serial_2 seria= l_3 - at_keyboard usb_keyboard)) + at_keyboard usb_keyboard)) =20 (io (string-append - "terminal_output " - (symbols->string - (map - (lambda (output) - (if (memq output valid-outputs) output #f)) outputs= )) "\n" - (if (null? inputs) - "" - (string-append - "terminal_input " - (symbols->string - (map - (lambda (input) - (if (memq input valid-inputs) input #f)) inputs= )) "\n")) - ;; UNIT and SPEED are arguments to the same GRUB command - ;; ("serial"), so we process them together. - (if (or unit speed) - (string-append - "serial" - (if unit - ;; COM ports 1 through 4 - (if (and (exact-integer? unit) (<=3D unit 3) (>=3D = unit 0)) - (string-append " --unit=3D" (number->string unit)= ) - #f) - "") - (if speed - (if (exact-integer? speed) - (string-append " --speed=3D" (number->string spee= d)) - #f) - "")) - "")))) + "terminal_output " + (symbols->string + (map + (lambda (output) + (if (memq output valid-outputs) output #f)) outputs)) = "\n" + (if (null? inputs) + "" + (string-append + "terminal_input " + (symbols->string + (map + (lambda (input) + (if (memq input valid-inputs) input #f)) inpu= ts)) "\n")) + ;; UNIT and SPEED are arguments to the same GRUB comma= nd + ;; ("serial"), so we process them together. + (if (or unit speed) + (string-append + "serial" + (if unit + ;; COM ports 1 through 4 + (if (and (exact-integer? unit) (<=3D unit 3) = (>=3D unit 0)) + (string-append " --unit=3D" (number->stri= ng unit)) + #f) + "") + (if speed + (if (exact-integer? speed) + (string-append " --speed=3D" (number->str= ing speed)) + #f) + "")) + "")))) (format #f "~a" io))) =20 (define (grub-root-search device file) @@ -293,6 +320,8 @@ code." =20 (define* (grub-configuration-file config entries #:key + (keyboard-layout-file + (grub-keyboard-layout-file)) (system (%current-system)) (old-entries '())) "Return the GRUB configuration file corresponding to CONFIG, a @@ -329,6 +358,14 @@ entries corresponding to old generations of the syst= em." (menu-entry-device-mount-point (first all-entries)) #:system system #:port #~port)) + (define keyboard-layout-config + #~(let ((keymap #$keyboard-layout-file)) + (if (eq? 'no-keymap-used keymap) + (format port "") + (format port "terminal_input at_keyboard +insmod keylayouts +keymap ~a +" keymap)))) =20 (define builder #~(call-with-output-file #$output @@ -338,6 +375,7 @@ entries corresponding to old generations of the syste= m." # will be lost upon reconfiguration. ") #$sugar + #$keyboard-layout-config (format port " set default=3D~a set timeout=3D~a~%" @@ -426,17 +464,17 @@ submenu \"GNU system, old configurations...\" {~%") =20 (define-syntax grub-configuration (syntax-rules (grub) - ((_ (grub package) fields ...) - (if (eq? package grub) - (bootloader-configuration - (bootloader grub-bootloader) - fields ...) - (bootloader-configuration - (bootloader grub-efi-bootloader) - fields ...))) - ((_ fields ...) - (bootloader-configuration - (bootloader grub-bootloader) - fields ...)))) + ((_ (grub package) fields ...) + (if (eq? package grub) + (bootloader-configuration + (bootloader grub-bootloader) + fields ...) + (bootloader-configuration + (bootloader grub-efi-bootloader) + fields ...))) + ((_ fields ...) + (bootloader-configuration + (bootloader grub-bootloader) + fields ...)))) =20 ;;; grub.scm ends here diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 2a595fafa..3cc331dcb 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -55,6 +55,7 @@ #:use-module (gnu packages swig) #:use-module (gnu packages valgrind) #:use-module (gnu packages virtualization) + #:use-module (gnu packages xorg) #:use-module (gnu packages web) #:use-module (guix build-system gnu) #:use-module (guix download) @@ -110,6 +111,12 @@ ;; Make the font visible. (copy-file (assoc-ref inputs "unifont") "unifont.bd= f.gz") (system* "gunzip" "unifont.bdf.gz") + + ;; patch the path to ckbcomp + (substitute* "util/grub-kbdcomp.in" + (("^ckbcomp ") + (string-append (assoc-ref inputs "console-setup"= ) + "/bin/ckbcomp "))) #t)) (add-before 'check 'disable-flaky-test (lambda _ @@ -134,6 +141,10 @@ ;; to determine whether the root file system is RAID. ("mdadm" ,mdadm) =20 + ;; console-setup's ckbcomp is invoked by grub-kbdcomp + ;; it is required for generating alternative keyboard layouts + ("console-setup" ,console-setup) + ("freetype" ,freetype) ;; ("libusb" ,libusb) ;; ("fuse" ,fuse) diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm index 9aa65291b..0a95a21cf 100644 --- a/gnu/packages/xorg.scm +++ b/gnu/packages/xorg.scm @@ -46,6 +46,7 @@ #:use-module (gnu packages) #:use-module (gnu packages anthy) #:use-module (gnu packages autotools) + #:use-module (gnu packages base) #:use-module (gnu packages bison) #:use-module (gnu packages check) #:use-module (gnu packages compression) @@ -6258,3 +6259,123 @@ selecting windows by pointing select actual focus= ed X11 window, selecting by window name or id, forcing toggle, increase or decrease opacity.") (home-page "http://forchheimer.se/transset-df/") (license license:x11))) + +(define-public bdfresize + (package + (name "bdfresize") + (version "1.5-11") + (source + (origin + (method url-fetch) + (uri (string-append "https://salsa.debian.org/debian/bdfresize/-/= archive/debian/" + version "/bdfresize-debian-"version ".tar.bz2= ")) + (sha256 + (base32 + "1fcn0hhzk8g3h0x50n982jwgsivhkqfd50bqs3iv2db3j4bnxp51")))) + (build-system gnu-build-system) + (arguments + '(;; #:make-flags + ;; (let ((bash (assoc-ref %build-inputs "bash")) + ;; (out (assoc-ref %outputs "out"))) + ;; (list (string-append "SHELL=3D" bash "/bin/bash") + ;; ;; (string-append "prefix=3D" out) + ;; )) + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key build configure-flags outputs inputs + #:allow-other-keys #:rest args) + (let ((out (assoc-ref outputs "out"))) + ;; The default configure tries to pass + ;; SHELL=3D/gnu/store/=E2=80=A6-bash-minimal-4.4.23/bin/b= ash + ;; This breaks the configure script with: + ;; "error: can only configure for one host and one target= at a time" + (setenv "CONFIG_SHELL" + (string-append (assoc-ref %build-inputs "bash") + "/bin/bash")) + (zero? (system* "./configure" + + "--build" build + "--prefix" out))))) + (add-after 'configure 'fix-for-new-gcc + ;; TODO might upstream, once upstream is back + (lambda _ + (substitute* "charresize.c" + (("char\t\\*malloc\\(\\);") + "")) + #t))))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (inputs `(("perl" ,perl))) + (synopsis "") + (description "") + ;; latest upstream vanished, using debian fork for now + ;; used to be: http://openlab.jp/efont/ + (home-page "https://tracker.debian.org/pkg/bdfresize") + (license license:x11)) ) + +(define-public console-setup + (package + (name "console-setup") + (version "1.188") + (source + (origin + (method url-fetch) + (uri (string-append "https://salsa.debian.org/installer-team/cons= ole-setup/-/archive/" + version "/console-setup-" version ".tar.bz2")= ) + (sha256 + (base32 + "1v6zfnsp1fakv1q8b68wdjjxscpw2sbmw2fpqw5af4b3isha5sgr")))) + (build-system gnu-build-system) + (arguments + '(#:make-flags + (let ((bash (assoc-ref %build-inputs "bash")) + (out (assoc-ref %outputs "out"))) + (list (string-append "SHELL=3D" bash "/bin/bash") + ;; (string-append "prefix=3D" out) + )) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'make-doubled-bdfs + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "Fonts" + (zero? (system* (string-append (assoc-ref inputs "make") + "/bin/make") + "doubled_bdfs" + (string-append "SHELL=3D" + (assoc-ref inputs "bash") + "/bin/bash")))))) + (delete 'check) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref %outputs "out"))) + (zero? (system* (string-append (assoc-ref inputs "make") + "/bin/make") + "install-linux" + (string-append "prefix=3D" out) + (string-append "SHELL=3D" + (assoc-ref inputs "bash") + "/bin/bash"))))))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ;; ("bash" ,bash) + ("bdftopcf" ,bdftopcf) + ("bdfresize" ,bdfresize) + ("sharutils" ,sharutils) + ("make" ,gnu-make) + )) + (inputs `(("perl" ,perl))) + (synopsis "") + (description "console-setup provides the console with the same +keyboard configuration scheme that X Window System has. +In result, there is no need to duplicate or change the console keyboard +files just to make simple customizations such as the use of dead keys, +the key functioning as AltGr or Compose key, the key(s) to switch betwee= n +Latin and non-Latin layouts, etc. Besides the keyboard, +the package configures also the font on the console. +It includes a rich collection of fonts and supports several languages th= at + would be otherwise unsupported on the console (such as Armenian, Georgi= an, + Lao and Thai).") + (home-page "https://salsa.debian.org/installer-team/console-setup/") + (license license:x11))) --=20 2.20.1 --------------3EBD3F2B128572343FEBCAEE Content-Type: text/x-patch; name="0001-services-Init-the-keyboard-layout-in-xorg-configurat.patch" Content-Disposition: attachment; filename*0="0001-services-Init-the-keyboard-layout-in-xorg-configurat.pa"; filename*1="tch" Content-Transfer-Encoding: quoted-printable >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-co= nfig. * 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 f= ormat using @command{lsh-export-key} (@pxref{Converting keys,,, lsh, LSH Manual}): =20 @example -$ lsh-export-key --openssh < /etc/lsh/host-key.pub=20 +$ lsh-export-key --openssh < /etc/lsh/host-key.pub ssh-rsa AAAAB3NzaC1yc2EAAAAEOp8FoQAAAQEAs1eB46LV@dots{} @end example =20 @@ -2807,13 +2807,13 @@ produced by @command{guix pull}, along with detai= ls about their provenance: =20 @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 =20 -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 =20 -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}): =20 @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''. =20 -The @code{#:main-class} parameter can be used with the minimal ant=20 -buildfile to specify the main class of the resulting jar. This makes th= e=20 -jar file executable. The @code{#:test-include} parameter can be used to= =20 +The @code{#:main-class} parameter can be used with the minimal ant +buildfile to specify the main class of the resulting jar. This makes th= e +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 shoul= d 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 mor= e +details on the arguments. The result should be used in place of @code{s= tartx}. =20 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 la= yout -than the default US keymap. For instance, to use the ``b=C3=A9po'' keym= ap 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 =3D> - (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 configu= ration -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 ex= ample, -the user typically used @code{setxkbmap fr bepo} to set their favorite k= eymap -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 =20 @deffn {Scheme Procedure} screen-locker-service @var{package} [@var{prog= ram}] @@ -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 lis= t + of tty/font pairs like: -+=20 ++ + '(("tty1" . "LatGrkCyr-8x16")) relevance: 20 =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 =C2=A9 2017 Andy Wingo ;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017 Ludovic Court=C3=A8s <= ludo@gnu.org> ;;; Copyright =C2=A9 2015 Sou Bunnbu +;;; Copyright =C2=A9 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 pat= hs for all the common drivers. @@ -222,6 +225,21 @@ EndSection\n" port) port) (newline port) =20 + (when #$keyboard-layout + (display "Section \"InputClass\" + Identifier \"evdev keyboard catchall\" + MatchIsKeyboard \"on\"\n" port) + (format port + " Option \"XkbLayout\" ~s\n" #$keyboard-lay= out) + (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)) =20 =20 -(define (xorg-configuration-directory modules) +(define* (xorg-configuration-directory modules) "Return a directory that contains the @code{.conf} files for X.org tha= t includes the @code{share/X11/xorg.conf.d} directories of each package li= sted in @var{modules}." @@ -255,6 +273,7 @@ in @var{modules}." files) #t)))) =20 + (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 mod= ule -packages, and @var{fonts}, a list of X font directories, are available. = See -@code{xorg-wrapper} for more details on the arguments. The result shoul= d 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/deskt= op.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. =20 (use-modules (gnu) (gnu system nss)) -(use-service-modules desktop) +(use-service-modules desktop xorg) (use-package-modules certs gnome) =20 (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 =3D> + (slim-configuration + (inherit config) + (startx + (xorg-start-command + #:configuration-file + (xorg-configuration-file + #:keyboard-layout "us" + #:keyboard-variant #f)))))))) =20 ;; 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/ex= amples/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. =20 (use-modules (gnu) (gnu system nss)) -(use-service-modules desktop) +(use-service-modules desktop xorg) (use-package-modules bootloaders certs ratpoison suckless wm) =20 (operating-system @@ -46,7 +46,16 @@ =20 ;; 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 =3D> + (slim-configuration + (inherit config) + (startx + (xorg-start-command + #:configuration-file + (xorg-configuration-file + #:keyboard-layout "us" + #:keyboard-variant #f))))))) =20 ;; Allow resolution of '.local' host names with mDNS. (name-service-switch %mdns-host-lookup-nss)) --=20 2.20.1 --------------3EBD3F2B128572343FEBCAEE--