aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/newbs_building_firmware.md14
-rwxr-xr-xutil/new_keymap.sh40
2 files changed, 54 insertions, 0 deletions
diff --git a/docs/newbs_building_firmware.md b/docs/newbs_building_firmware.md
index f227d623f..ac6bff2bc 100644
--- a/docs/newbs_building_firmware.md
+++ b/docs/newbs_building_firmware.md
@@ -22,6 +22,20 @@ Start by navigating to the `keymaps` folder for your keyboard.
22 22
23Once you have the `keymaps` folder open you will want to create a copy of the `default` folder. We highly recommend you name your folder the same as your GitHub username, but you can use any name you want as long as it contains only lower case letters, numbers, and the underscore character. 23Once you have the `keymaps` folder open you will want to create a copy of the `default` folder. We highly recommend you name your folder the same as your GitHub username, but you can use any name you want as long as it contains only lower case letters, numbers, and the underscore character.
24 24
25To automate the process, you also have the option to run the `new_keymap.sh` script.
26
27Navigate to the `qmk_firmware/util` directory and type the following:
28
29```
30./new_keymap.sh <keyboard path> <username>
31```
32
33For example, for a user named John, trying to make a new keymap for the 1up60hse, they would type in
34
35```
36./new_keymap.sh 1upkeyboards/1up60hse john
37```
38
25## Open `keymap.c` In Your Favorite Text Editor 39## Open `keymap.c` In Your Favorite Text Editor
26 40
27Open up your `keymap.c`. Inside this file you'll find the structure that controls how your keyboard behaves. At the top of `keymap.c` there may be some defines and enums that make the keymap easier to read. Farther down you'll find a line that looks like this: 41Open up your `keymap.c`. Inside this file you'll find the structure that controls how your keyboard behaves. At the top of `keymap.c` there may be some defines and enums that make the keymap easier to read. Farther down you'll find a line that looks like this:
diff --git a/util/new_keymap.sh b/util/new_keymap.sh
new file mode 100755
index 000000000..b09f3dd0c
--- /dev/null
+++ b/util/new_keymap.sh
@@ -0,0 +1,40 @@
1#!/bin/sh
2# Script to make a new keymap for a keyboard of your choosing
3# This script automates the copying of the default keymap into
4# your own keymap
5
6KB_PATH=$(echo "$1" | tr 'A-Z' 'a-z')
7USERNAME=$(echo "$2" | tr 'A-Z' 'a-z')
8
9if [ -z "$KB_PATH" ]; then
10 printf "Usage: %s <keyboard_path> <username>\n" "$0"
11 printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0"
12 exit 1
13fi
14
15if [ -z "$USERNAME" ]; then
16 printf "Usage: %s <keyboard_path> <username>\n" "$0"
17 printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0"
18 exit 1
19fi
20
21cd ..
22
23if [ ! -d "keyboards/$KB_PATH" ]; then
24 printf "Error! keyboards/%s does not exist!\n" "$KB_PATH"
25 exit 1
26fi
27
28if [ -d "keyboards/$KB_PATH/keymaps/$USERNAME" ]; then
29 printf "Error! keyboards/%s/keymaps/%s already exists!\n" "$KB_PATH" "$USERNAME"
30 exit 1
31fi
32
33# Recursively copy the chosen keyboard's default keymap
34cp -r keyboards/"$KB_PATH"/keymaps/default keyboards/"$KB_PATH"/keymaps/"$USERNAME"
35
36printf "%s keymap directory created in: qmk_firmware/keyboards/%s/keymaps/\n\n" "$USERNAME" "$KB_PATH"
37
38printf "Compile a firmware file with your new keymap by typing: \n"
39printf " make %s:%s\n" "$KB_PATH" "$USERNAME"
40printf "from the qmk_firmware directory\n" \ No newline at end of file