This repository adds a Windows-style Persian keyboard layout to Linux systems that use XKB. It is intended for users who are comfortable with the Persian layout on Microsoft Windows and want the same key positions on Linux.
The layout is registered as:
Persian (Windows)
The XKB variant name is:
pes_winkeys
Note If your Linux distribution ships a version of
xkeyboard-configthat includes merge request !473, a Windows Persian layout may already be available. In that case, you do not need this repository.
- A Linux distribution that uses XKB keyboard layouts.
- Root access for modifying system keyboard layout files.
xmlstarletfor the automatic installer.
Install xmlstarlet with your distribution package manager before running the automatic installer. For example, on Debian or Ubuntu:
sudo apt install xmlstarletThe installer appends the Persian Windows layout to the system ir symbols file and registers the layout in the XKB evdev.xml registry.
Warning The automatic installer is intentionally small and does not fully manage upgrades from older versions of this project. If you previously installed this layout manually or from an older release, inspect your XKB files before running the installer.
- Clone the repository:
git clone https://github.com/sinadarvi/windows-persian-keyboard-for-linux.git
cd windows-persian-keyboard-for-linux- Run the installer as root:
sudo ./install- Open your desktop environment's keyboard settings and add:
Persian (Windows)
The installer creates .backup copies of the modified XKB files before changing them.
After installation, you can enable the layout for the current X11 session with:
setxkbmap -layout us,ir -variant ',pes_winkeys' -option grp:alt_shift_toggleThis configures two layouts:
usfor English.irwith thepes_winkeysvariant for Persian.
It also enables switching between layouts with Alt + Shift. The leading comma in ',pes_winkeys' means that no variant is applied to the first layout (us).
To make the command persistent, add it to your X session startup configuration, such as ~/.xprofile, ~/.xinitrc, or your desktop environment/window manager autostart configuration.
Avoid placing this command in ~/.bashrc; that file runs for every interactive shell and may run when no X11 session is available.
For i3, add this line to your i3 configuration:
exec_always --no-startup-id setxkbmap -layout us,ir -variant ',pes_winkeys' -option grp:alt_shift_toggleReload or restart i3 after saving the configuration.
The layout includes XKB's nbsp(zwnj2nb3nnb4) mapping for the Space key.
| Shortcut | Character |
|---|---|
| Space | Regular space |
| Shift + Space | Zero-width non-joiner, ZWNJ (U+200C) |
| Right Alt + Space | Non-breaking space |
| Shift + Right Alt + Space | Narrow non-breaking space |
The Windows shortcut Ctrl + Shift + 2 is not implemented by this layout.
Use manual installation if you want to review or apply the changes yourself.
- Clone the repository:
git clone https://github.com/sinadarvi/windows-persian-keyboard-for-linux.git
cd windows-persian-keyboard-for-linux- Back up the Persian symbols file and append
ir_patch:
sudo cp /usr/share/X11/xkb/symbols/ir /usr/share/X11/xkb/symbols/ir.backup
cat ./ir_patch | sudo tee -a /usr/share/X11/xkb/symbols/ir >/dev/null- Back up and edit the XKB layout registry:
sudo cp /usr/share/X11/xkb/rules/evdev.xml /usr/share/X11/xkb/rules/evdev.xml.backup
sudo vim /usr/share/X11/xkb/rules/evdev.xml- Find the Persian layout and add this variant to its
variantList:
<variant>
<configItem>
<name>pes_winkeys</name>
<description>Persian (Windows)</description>
</configItem>
</variant>- Open your keyboard settings and add:
Persian (Windows)
If the layout does not appear immediately, log out and back in, restart your desktop session, or reboot.
This project is released under the MIT License.