// Keyboard layouts for Belarus.

// Belarusian standard keyboard, by Alexander Mikhailian <mikhailian@altern.org>.
// Reworked to use Russian keymap as base and winkeys by default,
// by Paul Lubetsky <vegeek@gmail.com>, see https://bugs.freedesktop.org/23604.

// Added Belarusian-Russian and Russian-Belarusian variants,
// by Pavel Senchanka <pavel.senchanka@gmail.com>

default partial alphanumeric_keys
xkb_symbols "basic" {
	include "ru(winkeys)"
	name[Group1]= "Belarusian";

	key <AD07> {[  Cyrillic_ghe,         Cyrillic_GHE,        Ukrainian_ghe_with_upturn,  Ukrainian_GHE_WITH_UPTURN  ]};
	key <AD09> {[  Byelorussian_shortu,  Byelorussian_SHORTU  ]};
	key <AD12> {[  apostrophe,           apostrophe           ]};
	key <AB05> {[  Ukrainian_i,          Ukrainian_I          ]};
};

partial alphanumeric_keys
xkb_symbols "legacy" {
	include "by(basic)"
	name[Group1]= "Belarusian (legacy)";

	key <AE03> {[          3,  numbersign  ]};
	key <AE04> {[          4,    asterisk  ]};
	key <AE05> {[          5,       colon  ]};
	key <AE06> {[          6,       comma  ]};
	key <AE07> {[          7,      period  ]};
	key <AE08> {[          8,   semicolon  ]};
	key <AB10> {[      slash,    question  ]};
	key <BKSL> {[  backslash,         bar  ]};
};

partial alphanumeric_keys
xkb_symbols "latin" {
	include "latin"
	name[Group1]= "Belarusian (Latin)";

	key <AD02> {[    w,    W,    scaron,    Scaron    ]};
	key <AD07> {[    u,    U,    ubreve,    Ubreve    ]};
	key <AC02> {[    s,    S,    sacute,    Sacute    ]};
	key <AC08> {[    k,    K,    lacute,    Lacute    ]};
	key <AC09> {[    l,    L,    lstroke,   Lstroke   ]};
	key <AB01> {[    z,    Z,    zacute,    Zacute    ]};
	key <AB02> {[    x,    X,    zcaron,    Zcaron    ]};
	key <AB03> {[    c,    C,    cacute,    Cacute    ]};
	key <AB04> {[    v,    V,    ccaron,    Ccaron    ]};
	key <AB06> {[    n,    N,    nacute,    Nacute    ]};

	// Poland
	key <AD03> {[    e,    E,    eogonek,     Eogonek   ]};
	key <AD09> {[    o,    O,    oacute,      Oacute    ]};
	key <AC01> {[    a,    A,    aogonek,     Aogonek   ]};
	key <AC07> {[    j,    J,    zabovedot,   Zabovedot   ]};

	include "level3(ralt_switch)"
};

// Russian layout with Belarusian symbols on third level.
partial alphanumeric_keys
xkb_symbols "ru" {
	include "ru(winkeys)"
	name[Group1]= "Russian (Belarus)";

	key <AB05> {[ Cyrillic_i,        Cyrillic_I,        Ukrainian_i,         Ukrainian_I         ]};
	key <AD09> {[ Cyrillic_shcha,    Cyrillic_SHCHA,    Byelorussian_shortu, Byelorussian_SHORTU ]};
	key <AD12> {[ Cyrillic_hardsign, Cyrillic_HARDSIGN, U2019,               apostrophe          ]};

	include "level3(ralt_switch)"
};

// Belarusian layout extended with other East Slavic symbols (Russian, Ukrainian).
partial alphanumeric_keys
xkb_symbols "intl" {
	include "by(basic)"
	name[Group1]= "Belarusian (intl.)";

	// Russian
	key <AB05> {[ Ukrainian_i,         Ukrainian_I,         Cyrillic_i,        Cyrillic_I        ]};
	key <AD09> {[ Byelorussian_shortu, Byelorussian_SHORTU, Cyrillic_shcha,    Cyrillic_SHCHA    ]};
	key <AD12> {[ U2019,               apostrophe,          Cyrillic_hardsign, Cyrillic_HARDSIGN ]};

	// Ukrainian (Yi is usually on <AD12>, but it is already taken in our case).
	key <AC11> {[ Cyrillic_e,  Cyrillic_E,  Ukrainian_ie, Ukrainian_IE ]};
	key <AD11> {[ Cyrillic_ha, Cyrillic_HA, Ukrainian_yi, Ukrainian_YI ]};
	key <BKSL> {[ backslash,   bar,  Ukrainian_ghe_with_upturn,  Ukrainian_GHE_WITH_UPTURN ]};

	include "level3(ralt_switch)"
};

partial alphanumeric_keys
xkb_symbols "phonetic" {
	include "ru(phonetic)"
	name[Group1]= "Belarusian (phonetic)";

	// Mostly same as good old YAWERTY layout, but with correct
	// Belarusian i and ў (u-short) instead of щ (shcha). We also
	// keep originals on level3 just in case.
	key <AD12> {[ Byelorussian_shortu, Byelorussian_SHORTU, Cyrillic_shcha, Cyrillic_SHCHA ]};
	key <AD08> {[ Ukrainian_i, Ukrainian_I, Cyrillic_i, Cyrillic_I ]};

	// Lets also add level3+u to enable another way to input u-short
	key <AD07> {[ Cyrillic_u, Cyrillic_U, Byelorussian_shortu, Byelorussian_SHORTU ]};

	// Since we already enable level3 lets also do alternative
	// means for io and hardsign.
	key <AD03> {[ Cyrillic_ie, Cyrillic_IE, Cyrillic_io, Cyrillic_IO ]};
	key <AB02> {[ Cyrillic_softsign, Cyrillic_SOFTSIGN, Cyrillic_hardsign, Cyrillic_HARDSIGN ]};

	include "level3(ralt_switch)"
};
