Skip to content

How to add a keyboard layout on Linux that supports Arabic, Persian, and Urdu

Notifications You must be signed in to change notification settings

adamiturabi/arabic-persian-urdu-keyboard-layout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

arabic-persian-urdu-keyboard-layout

How to add a keyboard layout on Linux that supports Arabic, Persian, and Urdu.

Description

Take a look at src/my_ara to check out the layout.

  • SHIFT is the level-1 modifier

  • AltGr is the level-2 modifier (for adding dagger-alef, urdu/Persian characters, etc.)

  • SHIFT+AltGr is the level-3 modifier (for adding diacritical hamza, diacritical, maddah, etc.)

Procedure

  1. sudo edit /usr/share/X11/xkb/symbols/ara
    1. Copy-paste keyboard layout from src/my_ara to end of file.
  2. sudo edit /usr/share/X11/xkb/symbols/nbsp
    1. Copy-paste "no-break-space" description from src/my_nbsp to end of file.
  3. sudo edit /usr/share/X11/xkb/rules/evdev.xml
    1. Copy-paste the "variant" from src/my_evdev.xml and add as additional variant to "ara" layout after "azerty", "qwerty", "buckwalter", etc.
  4. CTRL-ALT-BACKSPACE to restart X or log-out and log back in.
  5. Find Keyboard layout settings in Desktop settings/configuration.
    1. Add "Arabic-Persian-Urdu (Custom)" from "Arabic" selection
  6. Pick suitable key to switch layouts. I choose CAPS LOCK.

Vim keymap

On his blog, Andreas Hallberg describes a methodolody for BiDi (RTL and LTR) editing in vim. This uses Arabic keymap binding within vim so that it doesn't affect vim commands.

The vim keymap file arabic-pc_utf-8.vim for my Mac based keyboard layout is in the directory vim-keymap. Andreas's Windows based keyboard layout is in his repo: https://github.com/andreasmhallberg/dotfiles/blob/master/arabic-pc_utf-8.vim

For neovim on MacOS , place this file in $HOME/.config/nvim/keymap/. For vim, place it in $HOME/.vim/keymap/.

On MacOS, terminal vim (installed using Homebrew) did not work with :set rightleft. But neovim on iterm2 worked. For iterm2, in order to use the Mac option key as the Meta modifier key in neovim, go to iterm2's Settings > Profile > Keys, and select the option to use the option keys as "Meta".

About

How to add a keyboard layout on Linux that supports Arabic, Persian, and Urdu

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published