1. Install Gujarati (and Hindi) Language Support
First, ensure the Gujarati language support packages are installed on your system. This downloads the necessary Unicode fonts (like Lohit-Gujarati) and rendering engines.
a) Go to System --> Administration --> Language Support.

b) Click Install/Remove Languages.

c) Select Gujarati and Hindi checkboxes. Let Linux install the languages. Once it finishes, go to the next step.

2. Download the Mapping File
3. Run the Installation Script
Select your installation method below. Modern Linux environments (like Wayland on Ubuntu) support Local Installation without root privileges. However, if your desktop environment (like Cinnamon on Linux Mint) ignores local files, use the System-Wide Fallback.
This script safely copies the layout into your user profile’s ~/.config/xkb/ directory. It will not be overwritten by system updates. Save this code as install-local.sh in the same folder as in.txt.
#!/bin/bash
XKB_DIR="$HOME/.config/xkb"
SYMBOLS_DIR="$XKB_DIR/symbols"
RULES_DIR="$XKB_DIR/rules"
mkdir -p "$SYMBOLS_DIR"
mkdir -p "$RULES_DIR"
if [ -f "in.txt" ]; then
cp in.txt "$SYMBOLS_DIR/in"
else
echo "Error: 'in.txt' not found in the current directory."
exit 1
fi
cat << 'EOF' > "$RULES_DIR/evdev.xml"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd">
<xkbConfigRegistry version="1.1">
<layoutList>
<layout>
<configItem>
<name>guj-ph</name>
<shortDescription>guj</shortDescription>
<description>Gujarati Phonetic</description>
<languageList><iso639Id>guj</iso639Id></languageList>
</configItem>
</layout>
<layout>
<configItem>
<name>hin-ph</name>
<shortDescription>hin</shortDescription>
<description>Hindi Phonetic</description>
<languageList><iso639Id>hin</iso639Id></languageList>
</configItem>
</layout>
</layoutList>
</xkbConfigRegistry>
EOF
echo "Local installation complete! Log out and log back in."
Run the script in your terminal:
chmod +x install-local.sh ./install-local.sh
After your chosen script completes, log off and log back into your desktop session for the changes to take effect.
4. Add the Layout to Your Keyboard Options
Lastly, you need to add the newly installed phonetic layouts to your active input sources. Note: The screenshots below demonstrate this in an older version of Ubuntu. On modern GNOME desktop environments, you will navigate to Settings > Keyboard > Input Sources. On KDE Plasma, navigate to System Settings > Input Devices > Keyboard.
a) Go to System --> Preferences --> Keyboard

b) Click on the Layout tab, then click Add...

c) Search for "Gujarati" and select the Gujarati Phonetic layout from the list.

d) If enabled correctly, you will see the language selection icon appear in your status bar, allowing you to toggle instantly between English and Gujarati.

