Fixes two issues with the default ua(unicode) layout on Ubuntu:
- The
\key incorrectly typesґinstead of\// AltGr+гdoes not produceґ/Ґ
The fix adds a fixed variant to the system Ukrainian layout that you can select in GNOME Settings like any other layout.
⚠️ These changes modify files under/usr/share/X11/xkb/. They will be lost if thexkb-datapackage is updated viaapt upgrade. Just re-run steps 1–3 if that happens.
sudo tee -a /usr/share/X11/xkb/symbols/ua << 'EOF'
partial alphanumeric_keys
xkb_symbols "fixed" {
include "ua(unicode)"
name[Group1]= "Ukrainian (Fixed)";
key <BKSL> { [ backslash, slash ] };
key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, Ukrainian_ghe_with_upturn, Ukrainian_GHE_WITH_UPTURN ] };
};
EOFThis creates a new variant called fixed that inherits everything from the default ua(unicode) layout and overrides just the two broken keys.
sudo sed -i '/^ ua /a\ fixed Ukrainian (Fixed)' /usr/share/X11/xkb/rules/evdev.lstUse Python to safely insert the variant — avoid using sed on XML as it can corrupt the file and break GNOME's layout picker entirely.
sudo python3 - << 'PYEOF'
import re
with open('/usr/share/X11/xkb/rules/evdev.xml', 'r') as f:
content = f.read()
new_variant = """ <variant>
<configItem>
<name>fixed</name>
<description>Ukrainian (Fixed)</description>
</configItem>
</variant>
"""
content = re.sub(
r'(<layout>\s*<configItem>\s*<name>ua</name>.*?<variantList>)(.*?)(</variantList>)',
lambda m: m.group(1) + m.group(2) + new_variant + m.group(3),
content,
flags=re.DOTALL,
count=1
)
with open('/usr/share/X11/xkb/rules/evdev.xml', 'w') as f:
f.write(content)
print("Done")
PYEOFgsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ua+fixed')]"Adjust the list to match your own active layouts. Then log out and back in.
The layout will now appear as Ukrainian (Fixed) in GNOME Settings → Keyboard → Input Sources.
If GNOME's layout picker stops working (shows only a few layouts, or the taskbar indicator disappears), it usually means evdev.xml was corrupted. Reinstall the package to restore it:
sudo apt install --reinstall xkb-dataThen re-run steps 1–3.