How to Install Gujarati and Hindi Language Support in Linux

If you like my Gujarati Phonetic or Hindi Phonetic keyboard layouts for Windows and you also use Linux, I have created these phonetic keyboard layouts for Linux as well. There is one limitation in Linux. You cannot type multiple characters with one keypress. Hence, in Linux, Shift+M does nothing while in Windows Shift+M types હ્મ, which is a combination of 3 characters (હ + ્ + મ). All of the keys in Windows which type multiple characters are omited in the Linux version.

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.

Linux Language Support Menu

b) Click Install/Remove Languages.

Linux Language Support Box

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

Linux Language Support Menu

2. Download the Mapping File

First, download the file called in.txt found here. This simple text file contains the physical key maps for the Gujarati and Hindi phonetic layouts. Save this file into a dedicated folder (e.g., your Downloads folder).

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

Linux Keyboard Selection Menu

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

Linux Keyboard Add

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

Linux Keyboard Add Gujarati

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.

Linux Keyboard Add Gujarati