Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements and new Persian layout from xkb PR !473 #18

Merged
merged 4 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 50 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,67 @@

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. Finally, this nightmare ended for me when I find what dear @KotlinFarsi did a few years ago. However, after following his instruction, I realized that this is not working at least on version 18.04 LTS+. So I decided to read his codes and generate an updated version of his file, which would work correctly.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove everything in this line after "predefined Persian language keyboard." I don't remember why i have added this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind, I can do it my self later 😀


The instruction is the same. you should add `ir_win` file and change some settings. 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.
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.

Enjoy.

## automatic installation :
1. You need to run the following command and the scrip will perform the steps for you.
**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.**

1. Clone the repository

```bash
git clone https://github.com/sinadarvi/windows-persian-keyboard-for-linux.git
cd windows-persian-keyboard-for-linux
```

2. Run the installer script as root

```bash
sudo ./install
```

3. All done! You can now go to your keyboard settings and add the `Persian (Windows)` layout.


## Manual Installation

1. Clone the repository

```bash
curl -s -L https://raw.githubusercontent.com/sinadarvi/windows-persian-keyboard-for-ubuntu/master/install | sudo bash -
git clone https://github.com/sinadarvi/windows-persian-keyboard-for-linux.git
cd windows-persian-keyboard-for-linux
```
2. now go to `settings > Keyboard` (or where ever your keyboard perference is) and in input sources click on `+` button and search for `Persian (Windows layout)`, and add it.

2. Append the `ir_patch` file from the repo to the `ir` symbols file.

## Manual installation:
1. add 'ir_win' layout to linux symbols
```bash
wget https://raw.githubusercontent.com/sinadarvi/windows-persian-keyboard-for-linux/master/ir_win -P /usr/share/X11/xkb/symbols/```
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
```
2. Add the new layout declaration to /usr/share/X11/xkb/rules/evdev.xml

3. Edit the xkb layouts registry with your text editor of choice (vim for example),

```bash
sudo gedit /usr/share/X11/xkb/rules/evdev.xml
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
```
3. add this layout after `ir` layout

find the Persian layout and add this variant to the list of variants for Persian:

```xml
...
<layout>
<configItem>
<name>ir_win</name>
<shortDescription>fa</shortDescription>
<description>Persian (Windows layout)</description>
<languageList>
<iso639Id>per-win</iso639Id>
</languageList>
</configItem>
<variantList>
</variantList>
</layout>
...
<variant>
<configItem>
<name>pes_winkeys</name>
<description>Persian (Windows)</description>
</configItem>
</variant>
```
4. now go to `settings > Keyboard` (or where ever your keyboard perference is) and in input sources click on `+` button and search for `Persian (Windows layout)`, and add it.


4. All done! You can now go to your keyboard settings and add the `Persian (Windows)` layout.
Loading