2

I'm trying to make a custom keyboard variant for Ubuntu 17.10 with default gnome (Xorg).

In file /usr/share/X11/xkb/symbols/be I added the text below:

partial alphanumeric_keys
xkb_symbols "r03" {
include "be(basic)"
name[Group1]="Belgian (r03)";

key <TLDE>  { [ at, threesuperior, onesuperior, lessthanequal ] };

};

There will be more changes, but this is a test. The key above tab should be '@'.
(My complete layout is available here: https://github.com/roelandmoors/azerty#installing-on-linux)

I also changed /usr/share/X11/xkb/rules/evdev.xml to add this new variant to the 'be' layout:

<variant>
  <configItem>
    <name>r03</name>
    <description>Belgian (r03)</description>
  </configItem>
</variant>  

The folder /var/lib/xkb only contains a readme.

When I use setxkbmap -layout be -variant r03 the new keymap seems to work fine.

The problem is that I can't select the new variant when I run sudo dpkg-reconfigure keyboard-configuration. In the gnome settings I can't even select a variant. I tried with the dconf editor to change /org/gnome/desktop/input-sources/sources to [('xkb', 'be+r03')] but then I get a querty layout instead of azerty. (fallback if settings is wrong?)

How can I make my new layout selectable in the settings. I want this as my default keyboard layout (also in gdm).

Update:

I got sudo dpkg-reconfigure keyboard-configuration working, but it is very uggly. (don't do it, just edit /etc/default/keyboard)

Copy the output of this command:

sudo /usr/share/console-setup/kbdnames-maker /usr/share/console-setup/KeyboardNames.pl | grep r03

I should be something like this: C*variant*be*r03*Belgian - Belgian (r03)

Then add this line to this file: (search for similar lines)

sudo vi /var/lib/dpkg/info/keyboard-configuration.config

Now you can select the new variant in dpkg-reconfigure keyboard-configuration.

roeland
  • 445

2 Answers2

2

To make the custom layout selectable also on the login screen, you can go to Settings -> Region & Language, click the Login Screen button at the top right of the window, and add it there as well.

enter image description here

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
1

The manual way to make the custom layout available on the login screen is to edit the /etc/default/keyboard file. Assuming that it currently includes these two lines:

XKBLAYOUT="be"
XKBVARIANT=""

you can e.g. change them to read:

XKBLAYOUT="be,be"
XKBVARIANT="r03,"

After next reboot, a keyboard layout indicator should be visible allowing you to choose betweeen Belgian (r03) and Belgian. Probably the former willl be preselected.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
  • Thx, that works as you describe. I think this could also be done with dpkg-reconfigure keyboard-configuration, but there I can't select my new layout variant. – roeland Nov 08 '17 at 18:38
  • @r03: I suspect that the reason is that you didn't edit the evdev.lst file too. But it's a guess; didn't test. – Gunnar Hjalmarsson Nov 08 '17 at 18:51
  • I don't think that is the problem. It looks like the program reads xorg.xml. https://anonscm.debian.org/cgit/d-i/console-setup.git/tree/Keyboard/xmlreader But it's OK. I changed the default keyboard file and it works. – roeland Nov 08 '17 at 23:03
  • @r03: xorg.xml is a symlink pointing to base.xml, so then maybe copying the modified evdev.xml to base.xml would make a difference (for some reason they both exist on Ubuntu and they are identical). – Gunnar Hjalmarsson Nov 09 '17 at 03:27
  • That didn't work. I added an uggly fix in my answer. – roeland Nov 09 '17 at 21:57
  • @r03: Thanks for the research! This is apparently a complex topic. – Gunnar Hjalmarsson Nov 09 '17 at 22:09