Keyboard layout configuration on Linux

The keyboard layout is configured by the setxkbmap(1) command whose options are described in xkeyboard-config(1). For example, the following command can be used to configure the canadian-french layout with the euro sign as an alternative character on the 5.

$ setxkbmap -layout ca -variant fr -option eurosign:5

For this configuration to be permanent with the Gnome environment, the layout can be configured using the UI configuration tool, but the options have to be configured in the following gsettings key.

$ gsettings get org.gnome.desktop.input-sources xkb-options
['grp:alt_shift_toggle', 'grp_led:scroll']
New options can then be added with the following command.
$ gsettings set org.gnome.desktop.input-sources xkb-options "['grp:alt_shift_toggle', 'grp_led:scroll', 'eurosign:5']"

Other relevant options are nbsp:level3.

Custom alternative characters

To add an custom alternative character, one can either change directly the layout (e.g. the canadian-french in the file /usr/share/X11/xkb/symbols/ca) or create new options à la eurosign:5.

To do the later, first write the options in a new file (e.g. /usr/share/X11/xkb/symbols/logic).

partial
xkb_symbols "greek" {
    key <AC01>  { [  NoSymbol,   NoSymbol, Greek_alpha,   Greek_ALPHA   ] };
    key <AB05>  { [  NoSymbol,   NoSymbol, Greek_beta,    Greek_BETA    ] };
    key <AC05>  { [  NoSymbol,   NoSymbol, Greek_gamma,   Greek_GAMMA   ] };
    key <AC03>  { [  NoSymbol,   NoSymbol, Greek_delta,   Greek_DELTA   ] };
    key <AD03>  { [  NoSymbol,   NoSymbol, Greek_epsilon, Greek_EPSILON ] };

    key <AC09>  { [  NoSymbol,   NoSymbol, Greek_lambda,  Greek_LAMBDA  ] };

    key <AD05>  { [  NoSymbol,   NoSymbol, Greek_tau,     Greek_TAU     ] };
};

Then add the option to /usr/share/X11/xkb/rules/evdev.

logic:greek = +logic(greek)

Then the option can be added to gsettings as for the euro sign.

$ gsettings set org.gnome.desktop.input-sources xkb-options "['grp:alt_shift_toggle', 'grp_led:scroll', 'eurosign:5', 'logic:greek']"