|
| 1 | +### **Table of Contents** |
| 2 | + |
| 3 | +- [Forking Monkeytype](#forking-monkeytype) |
| 4 | +- [Creating Layouts](#creating-layouts ) |
| 5 | +- [Committing Layouts](#committing-layouts) |
| 6 | + |
| 7 | +### Forking Monkeytype |
| 8 | + |
| 9 | +First, you will have to make a personal copy of the Monkeytype repository, also known as "forking". Go to the [Monkeytype repo](https://github.com/monkeytypegame/monkeytype/) and then click the "fork" button. |
| 10 | + |
| 11 | +<img width="1552" alt="Screenshot showing location of the fork button on GitHub." src="https://user-images.githubusercontent.com/83455454/149194972-23343642-7a1f-4c0c-b5f2-36f4b39a2639.png"> |
| 12 | + |
| 13 | +## Creating Layouts |
| 14 | + |
| 15 | +Once you have forked the repository you can now add your layout. Create a new JSON file in `./frontend/static/layouts/`, named as the layout name, e.g. `qwerty.json`. |
| 16 | + |
| 17 | +The contents of the file should be as follows: |
| 18 | + |
| 19 | +```json |
| 20 | +{ |
| 21 | + "keymapShowTopRow": false, |
| 22 | + "type": "ansi", |
| 23 | + "keys": { |
| 24 | + "row1": ["`~", "1!", "2@", "3#", "4$", "5%", "6^", "7&", "8*", "9(", "0)", "-_", "=+"], |
| 25 | + "row2": ["qQ", "wW", "eE", "rR", "tT", "yY", "uU", "iI", "oO", "pP", "[{", "]}", "\\|"], |
| 26 | + "row3": ["aA", "sS", "dD", "fF", "gG", "hH", "jJ", "kK", "lL", ";:", "'\""], |
| 27 | + "row4": ["zZ", "xX", "cC", "vV", "bB", "nN", "mM", ",<", ".>", "/?"], |
| 28 | + "row5": [" "] |
| 29 | + } |
| 30 | +} |
| 31 | + |
| 32 | +``` |
| 33 | + |
| 34 | +It is recommended that you familiarize yourselves with JSON before adding a layout. |
| 35 | + |
| 36 | +`keymapShowTopRow` indicates whether to always show the first row of the layout. |
| 37 | +`type` can be `ansi` or `iso`. |
| 38 | + |
| 39 | +In `keys` you need to specify `row1` to `row5`. Add the keys within the row as string. The string can have up to four character. The character define unshifted, shifted, alt-gr and shifted alt-gr character in this order. For example `eE€` defines `e` on regular key press, `E` if `shift` is held and `€` if `alt-gr` is held. |
| 40 | + |
| 41 | +**Note:** Quote and backslash characters need to be escaped: `\"` and `\\`. |
| 42 | + |
| 43 | +For ansi layouts the number of keys need to be exactly thirteen for `row1` and `row2`, eleven for `row3`, ten for `row4` and one or two for `row5`. |
| 44 | + |
| 45 | +For iso the number of keys need to be exactly thirteen for `row1`, twelve for `row2` and `row3`, eleven for `row4` and one or two for `row5`. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +In addition to the layout file you need to add your layout to the `frontend/src/ts/constants/layouts.ts` file. Just append your layout name (without the `.json`) at the __end__ of the array. Remember to add a comma like this: |
| 50 | + |
| 51 | +```ts |
| 52 | + "ergopti", |
| 53 | + "sword", |
| 54 | + "YOUR_LAYOUT", |
| 55 | +]; |
| 56 | +``` |
| 57 | + |
| 58 | +### Committing Layouts |
| 59 | + |
| 60 | +Once you have created your layout, you now need to create a pull request to the main Monkeytype repository. Go to the branch where you created your layout on GitHub. Then make sure your branch is up to date. Once it is up to date, click "contribute". |
| 61 | + |
| 62 | +Update branch: |
| 63 | +<img width="1552" alt="Screenshot showing how to update the fork to match the main Monkeytype repository" src="https://user-images.githubusercontent.com/83455454/149186547-5b9fe4fd-b944-4eed-a959-db43f96198bf.png"> |
| 64 | + |
| 65 | +Create a pull request: |
| 66 | +<img width="1552" alt="Screenshot showing how to create a pull request to the main Monkeytype repository" src="https://user-images.githubusercontent.com/83455454/149186637-66dae488-05ae-45c4-9217-65bc36c4927b.png"> |
| 67 | + |
| 68 | +Make sure your PR title follow the syntax `feat(layout): add <YOUR_LAYOUT> layout (@<YOUR_GITHUB_NAME>)`, e.g. `feat(layout): add qwerty layout (@teddinotteddy)` |
| 69 | + |
| 70 | +## Layout Guidelines |
| 71 | + |
| 72 | +Make sure your layout follows the [Layout guidelines](./CONTRIBUTING.md#layout-guidelines). |
0 commit comments