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']"

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   { [  NoSymbol,   NoSymbol, Greek_alpha,   Greek_ALPHA   ] };
    key   { [  NoSymbol,   NoSymbol, Greek_beta,    Greek_BETA    ] };
    key   { [  NoSymbol,   NoSymbol, Greek_gamma,   Greek_GAMMA   ] };
    key   { [  NoSymbol,   NoSymbol, Greek_delta,   Greek_DELTA   ] };
    key   { [  NoSymbol,   NoSymbol, Greek_epsilon, Greek_EPSILON ] };

    key   { [  NoSymbol,   NoSymbol, Greek_lambda,  Greek_LAMBDA  ] };

    key   { [  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']"