From 8a718e72dcb2b3025304832e88a36eb9997a080a Mon Sep 17 00:00:00 2001 From: cs127 Date: Mon, 20 Mar 2023 21:27:15 +0330 Subject: [PATCH] update layout, fix layout ID, add xkb 2.39 notice --- README.md | 12 ++++++------ install | 6 +++--- ir_patch | 28 ++++++++++++++-------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index dd3c59c..347ad9e 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ +**Note: if you are using xkeyboard-config version 2.39 or newer, you already have the Windows Persian layout installed, and don't need this repo.** + I have been looking for a way to change to the keyboard layout of the Persian language for the Ubuntu operating system for a few years, which might be identical to the one I used to have while I was a windows user. This is probably the problem of most of the people who want to use Ubuntu. However, they cannot switch to it since it is almost impossible to type correctly using its predefined Persian language keyboard. -The instruction is the same. you should modify the `ir` and `evdev.xml` files. I hope it would be helpful for those who get used to the layout of windows and love to work with a real operating system. +I hope it would be helpful for those who get used to the layout of Windows and love to work with a real operating system. Enjoy. -**Note: If your Linux distribution has a version of xkb with [!473](https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/473) merged, you already have a Windows Persian layout, and do not need this repo.** - ## Automatic Installation The automatic installer script requires `xmlstarlet` to be installed. Install it using your package manager before running the script. -**Warning: The automatic installer does not detect any previous versions of this project. Make sure you don't already have an older version of the Windows Persian layout installed.** +**Warning: The automatic installer does not detect any previous versions of this project. If you are updating from a previous version, make sure you don't already have an older version of the Windows Persian layout installed.** 1. Clone the repository @@ -43,7 +43,7 @@ cd windows-persian-keyboard-for-linux ```bash sudo cp /usr/share/X11/xkb/symbols/ir /usr/share/X11/xkb/symbols/ir.backup -sudo cat ./ir | sudo tee -a /usr/share/X11/xkb/symbols/ir &>/dev/null +cat ./ir_patch | sudo tee -a /usr/share/X11/xkb/symbols/ir >/dev/null ``` 3. Edit the xkb layouts registry with your text editor of choice (vim for example), @@ -58,7 +58,7 @@ find the Persian layout and add this variant to the list of variants for Persian ```xml - pes_winkeys + winkeys Persian (Windows) diff --git a/install b/install index a777d55..4fdc474 100755 --- a/install +++ b/install @@ -5,7 +5,7 @@ # https://github.com/sinadarvi/windows-persian-layout-for-linux # Script by cs127 -# 2023-03-11 +# 2023-03-20 # Requirements: # * xmlstarlet @@ -33,7 +33,7 @@ XKBREG="$XKBHOME/rules/evdev.xml" XML_IR="/xkbConfigRegistry/layoutList/layout[configItem/name='ir']" XML_VL="$XML_IR/variantList" -XML_VL_WIN="$XML_VL/variant[configItem/name='pes_winkeys']" +XML_VL_WIN="$XML_VL/variant[configItem/name='winkeys']" XML_VL_LAST="$XML_VL/variant[last()]" XML_VL_LCFG="$XML_VL_LAST/configItem" @@ -59,7 +59,7 @@ process_registry() { ! xmlstarlet ed -P -L \ -s "$XML_VL" -t elem -n "variant" \ -s "$XML_VL_LAST" -t elem -n "configItem" \ - -s "$XML_VL_LCFG" -t elem -n "name" -v "pes_winkeys" \ + -s "$XML_VL_LCFG" -t elem -n "name" -v "winkeys" \ -s "$XML_VL_LCFG" -t elem -n "description" -v "Persian (Windows)" \ "$XKBREG" && mv "$XKBREG.backup" "$XKBREG" && exitcode 12 diff --git a/ir_patch b/ir_patch index c7bec52..b8dbd35 100644 --- a/ir_patch +++ b/ir_patch @@ -4,19 +4,20 @@ // ======================== partial alphanumeric_keys -xkb_symbols "pes_winkeys" { +xkb_symbols "winkeys" { name[Group1]= "Persian (Windows)"; - key { [ Farsi_1, exclam ] }; - key { [ Farsi_2, at ] }; - key { [ Farsi_3, numbersign ] }; - key { [ Farsi_4, dollar ] }; - key { [ Farsi_5, percent ] }; - key { [ Farsi_6, asciicircum ] }; - key { [ Farsi_7, ampersand ] }; - key { [ Farsi_8, asterisk ] }; - key { [ Farsi_9, parenright ] }; - key { [ Farsi_0, parenleft ] }; + key { [ division, multiply ] }; + key { [ 1, exclam, Farsi_1, 0x100200d ] }; + key { [ 2, at, Farsi_2, 0x100200c ] }; + key { [ 3, numbersign, Farsi_3, 0x100200e ] }; + key { [ 4, dollar, Farsi_4, 0x100200f ] }; + key { [ 5, percent, Farsi_5 ] }; + key { [ 6, asciicircum, Farsi_6 ] }; + key { [ 7, ampersand, Farsi_7 ] }; + key { [ 8, asterisk, Farsi_8 ] }; + key { [ 9, parenright, Farsi_9 ] }; + key { [ 0, parenleft, Farsi_0 ] }; key { [ minus, underscore ] }; key { [ equal, plus ] }; @@ -44,9 +45,9 @@ xkb_symbols "pes_winkeys" { key { [ Arabic_meem, guillemotright ] }; key { [ Arabic_keheh, colon ] }; key { [ Arabic_gaf, quotedbl ] }; - key { [ division, multiply ] }; - key { [ Arabic_peh, bar ] }; + + key { [ Arabic_peh, bar ] }; key { [ Arabic_zah, Arabic_tehmarbuta ] }; key { [ Arabic_tah, Arabic_yeh ] }; key { [ Arabic_zain, Arabic_jeh ] }; @@ -58,6 +59,5 @@ xkb_symbols "pes_winkeys" { key { [ period, greater ] }; key { [ slash, Arabic_question_mark ] }; - include "nbsp(zwnj2nb3nnb4)" include "level3(ralt_switch)" };