unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 34929@debbugs.gnu.org
Subject: [bug#34929] [PATCH 12/12] doc: Document keyboard layout.
Date: Thu, 21 Mar 2019 00:04:35 +0100	[thread overview]
Message-ID: <20190320230435.25458-12-ludo@gnu.org> (raw)
In-Reply-To: <20190320230435.25458-1-ludo@gnu.org>

* doc/guix.texi (Keyboard Layout): New node.
(Bootloader Configuration): Remove examples and refer to it.
(X Window): Add cross-reference.
---
 doc/guix.texi | 126 ++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 108 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e2bd84493b..f339d52808 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -251,6 +251,7 @@ System Configuration
 * File Systems::                Configuring file system mounts.
 * Mapped Devices::              Block device extra processing.
 * User Accounts::               Specifying user accounts.
+* Keyboard Layout::             How the system interprets key strokes.
 * Locales::                     Language and cultural convention settings.
 * Services::                    Specifying system services.
 * Setuid Programs::             Programs running with root privileges.
@@ -10091,6 +10092,7 @@ instance to support new system services.
 * File Systems::                Configuring file system mounts.
 * Mapped Devices::              Block device extra processing.
 * User Accounts::               Specifying user accounts.
+* Keyboard Layout::             How the system interprets key strokes.
 * Locales::                     Language and cultural convention settings.
 * Services::                    Specifying system services.
 * Setuid Programs::             Programs running with root privileges.
@@ -10951,6 +10953,108 @@ Note that the ``root'' account is not included here.  It is a
 special-case and is automatically added whether or not it is specified.
 @end defvr
 
+@node Keyboard Layout
+@section Keyboard Layout
+
+To specify what each key of your keyboard does, you need to tell the operating
+system what @dfn{keyboard layout} you want to use.  The default, when nothing
+is specified, is the US English QWERTY layout for 105-key PC keyboards.
+However, German speakers will usually prefer the German QWERTZ layout, French
+speakers will want the AZERTY layout, and so on; hackers might prefer Dvorak
+or bépo, and they might even want to further customize the effect of some of
+the keys.  This section explains how to get that done.
+
+@cindex keyboard layout, definition
+There are three components that will want to know about your keyboard layout:
+
+@itemize
+@item
+The @emph{bootloader} may want to know what keyboard layout you want to use
+(@pxref{Bootloader Configuration, @code{keyboard-layout}}).  This is useful if
+you want, for instance, to make sure that you can type the passphrase of your
+encrypted root partition using the right layout.
+
+@item
+The @emph{operating system kernel}, Linux, will need that so that the console
+is properly configured (@pxref{operating-system Reference,
+@code{keyboard-layout}}).
+
+@item
+The @emph{graphical display server}, usually Xorg, also has its own idea of
+the keyboard layout (@pxref{X Window, @code{keyboard-layout}}).
+@end itemize
+
+Guix allows you to configure all three separately but, fortunately, it allows
+you to share the same keyboard layout for all three components.
+
+@cindex XKB, keyboard layouts
+Keyboard layouts are represented by records created by the
+@code{keyboard-layout} procedure of @code{(gnu system keyboard)}.  Following
+the X Keyboard extension (XKB), each layout has four attributes: a name (often
+a language code such as ``fi'' for Finnish or ``jp'' for Japanese), an
+optional variant name, an optional keyboard model name, and a possibly empty
+list of additional options.  In most cases the layout name is all you care
+about.  Here are a few example:
+
+@example
+;; The German QWERTZ layout.  Here we assume a standard
+;; "pc105" keyboard model.
+(keyboard-layout "de")
+
+;; The bépo variant of the French layout.
+(keyboard-layout "fr" "bepo")
+
+;; The Catalan layout.
+(keyboard-layout "es" "cat")
+
+;; The Latin American Spanish layout.  In addition, the
+;; "Caps Lock" keys is used as an additional "Ctrl" key,
+;; and the "Menu" key is used as a "Compose" key to enter
+;; accented letters.
+(keyboard-layout "latam"
+                 #:options '("ctrl:nocaps" "compose:menu"))
+
+;; The Russian layout for a ThinkPad keyboard.
+(keyboard-layout "ru" #:model "thinkpad")
+
+;; The "US international" layout, which is the US layout plus
+;; dead keys to enter accented characters.  This is for an
+;; Apple MacBook keyboard.
+(keyboard-layout "us" "intl" #:model "macbook78")
+@end example
+
+See the @file{share/X11/xkb} directory of the @code{xkeyboard-config} package
+for a complete list of supported layouts, variants, and models.
+
+@cindex keyboard layout, configuration
+Let's say you want your system to use the Turkish keyboard layout throughout
+your system---bootloader, console, and Xorg.  Here's what your system
+configuration would look like:
+
+@lisp
+;; Using the Turkish layout for the bootloader, the console,
+;; and for Xorg.
+
+(operating-system
+  ;; ...
+  (keyboard-layout (keyboard-layout "tr"))  ;for the console
+  (bootloader (bootloader-configuration
+                (bootloader grub-efi-bootloader)
+                (target "/boot/efi")
+                (keyboard-layout keyboard-layout))) ;for GRUB
+  (services (modify-services %desktop-services
+              (slim-service-type config =>
+                (slim-configuration
+                  (inherit config)
+                  (xorg-configuration
+                    (xorg-configuration             ;for Xorg
+                      (keyboard-layout keyboard-layout))))))))
+@end lisp
+
+In the example above, for GRUB and for Xorg, we just refer to the
+@code{keyboard-layout} field defined above, but we could just as well refer to
+a different layout.
+
 @node Locales
 @section Locales
 
@@ -13356,7 +13460,8 @@ If this is @code{#f}, Xorg uses the default keyboard layout---usually US
 English (``qwerty'') for a 105-key PC keyboard.
 
 Otherwise this must be a @code{keyboard-layout} object specifying the keyboard
-layout in use when Xorg is running.
+layout in use when Xorg is running.  @xref{Keyboard Layout}, for more
+information on how to specify the keyboard layout.
 
 @item @code{extra-config} (default: @code{'()})
 This is a list of strings or objects appended to the configuration file.  It
@@ -23130,23 +23235,8 @@ The number of seconds to wait for keyboard input before booting.  Set to
 If this is @code{#f}, the bootloader's menu (if any) uses the default keyboard
 layout, usually US@tie{}English (``qwerty'').
 
-Otherwise, this must be a @code{keyboard-layout} object.  For instance, the
-following example defines a standard German keyboard layout:
-
-@example
-(keyboard-layout "de")
-@end example
-
-@noindent
-while the example below designates the bépo layout for French:
-
-@example
-(keyboard-layout "fr" "bepo")
-@end example
-
-The layout name and variant must match an existing layout in the
-@code{xkeyboard-config} package under the @file{share/X11/xkb/symbols}
-directory.
+Otherwise, this must be a @code{keyboard-layout} object (@pxref{Keyboard
+Layout}).
 
 @quotation Note
 This option is currently ignored by bootloaders other than @code{grub} and
-- 
2.21.0

  parent reply	other threads:[~2019-03-20 23:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 22:32 [bug#34929] [PATCH 00/12] Provide uniform keyboard layout configuration Ludovic Courtès
2019-03-20 23:04 ` [bug#34929] [PATCH 01/12] bootloader: Remove unused 'additional-configuration' field Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 02/12] bootloader: Reindent record type definition Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 03/12] Add (gnu system keyboard) Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 04/12] bootloader: Add a 'keyboard-layout' field Ludovic Courtès
2019-03-24  9:31     ` Julien Lepiller
2019-03-24 21:18       ` Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 05/12] services: xorg: Remove unused #:guile parameter Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 06/12] services: xorg: Define and <xorg-configuration> record type Ludovic Courtès
2019-03-24  9:46     ` Julien Lepiller
2019-03-24 21:18       ` Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 07/12] services: sddm, slim, gdm: Take an <xorg-configuration> record Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 08/12] services: xorg: Add a 'keyboard-layout' field in <xorg-configuration> Ludovic Courtès
2019-03-24  9:50     ` Julien Lepiller
2019-03-20 23:04   ` [bug#34929] [PATCH 09/12] vm: 'virtualized-operating-system' inherits from the user's bootloader config Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 10/12] gnu: Add loadkeys-static Ludovic Courtès
2019-03-20 23:04   ` [bug#34929] [PATCH 11/12] system: Initialize console keyboard layout in the initrd Ludovic Courtès
2019-03-20 23:04   ` Ludovic Courtès [this message]
2019-03-24 10:03 ` [bug#34929] [PATCH 00/12] Provide uniform keyboard layout configuration Julien Lepiller
2019-03-24 22:14   ` bug#34929: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190320230435.25458-12-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=34929@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).