From 603707a13707435f130f15bd0265e03fed20734f Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Tue, 20 Apr 2021 12:50:08 +0200 Subject: [PATCH] nixos/doc/manual: refine extraLayouts, add warnings an test commands --- nixos/doc/manual/configuration/x-windows.xml | 43 ++++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/nixos/doc/manual/configuration/x-windows.xml b/nixos/doc/manual/configuration/x-windows.xml index a499f0080d70..757174c52632 100644 --- a/nixos/doc/manual/configuration/x-windows.xml +++ b/nixos/doc/manual/configuration/x-windows.xml @@ -204,18 +204,18 @@ XKB keyboard layouts using the option - . + . + + As a first example, we are going to create a layout based on the basic US layout, with an additional layer to type some greek symbols by pressing the right-alt key. - To do this we are going to create a us-greek file - with a xkb_symbols section. + Create a file called us-greek with the following + content (under a directory called symbols; it's + an XKB peculiarity that will help with testing): xkb_symbols "us-greek" @@ -231,14 +231,13 @@ xkb_symbols "us-greek" }; - To install the layout, the filepath, a description and the list of - languages must be given: + A minimal layout specification must include the following: .us-greek = { description = "US layout with alt-gr greek"; languages = [ "eng" ]; - symbolsFile = /path/to/us-greek; + symbolsFile = /yourpath/symbols/us-greek; } @@ -248,9 +247,27 @@ xkb_symbols "us-greek" - The layout should now be installed and ready to use: try it by - running setxkbmap us-greek and type - <alt>+a. To change the default the usual + Applying this customization requires rebuilding several packages, + and a broken XKB file can lead to the X session crashing at login. + Therefore, you're strongly advised to test + your layout before applying it: + +$ nix-shell -p xorg.xkbcomp +$ setxkbmap -I/yourpath us-greek -print | xkbcomp -I/yourpath - $DISPLAY + + + + You can inspect the predefined XKB files for examples: + +$ echo "$(nix-build --no-out-link '<nixpkgs>' -A xorg.xkeyboardconfig)/etc/X11/xkb/" + + + + Once the configuration is applied, and you did a logout/login + cycle, the layout should be ready to use. You can try it by e.g. + running setxkbmap us-greek and then type + <alt>+a (it may not get applied in your + terminal straight away). To change the default, the usual