diff options
author | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-04-10 12:13:40 +0100 |
commit | dc90387ce7d8ba7b607d9c48540bf6d8b560f14d (patch) | |
tree | 4ccb8fa5886b66fa9d480edef74236c27f035e16 /util/new_keymap.sh |
Diffstat (limited to 'util/new_keymap.sh')
-rwxr-xr-x | util/new_keymap.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/util/new_keymap.sh b/util/new_keymap.sh new file mode 100755 index 000000000..c483314fd --- /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 | |||
6 | KB_PATH=$(echo "$1" | tr 'A-Z' 'a-z') | ||
7 | USERNAME=$(echo "$2" | tr 'A-Z' 'a-z') | ||
8 | |||
9 | if [ -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 | ||
13 | fi | ||
14 | |||
15 | if [ -z "$USERNAME" ]; then | ||
16 | printf "Usage: %s <keyboard_path> <username>\n" "$0" | ||
17 | printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0" | ||
18 | exit 1 | ||
19 | fi | ||
20 | |||
21 | cd "$(dirname "$0")/.." | ||
22 | |||
23 | if [ ! -d "keyboards/$KB_PATH" ]; then | ||
24 | printf "Error! keyboards/%s does not exist!\n" "$KB_PATH" | ||
25 | exit 1 | ||
26 | fi | ||
27 | |||
28 | if [ -d "keyboards/$KB_PATH/keymaps/$USERNAME" ]; then | ||
29 | printf "Error! keyboards/%s/keymaps/%s already exists!\n" "$KB_PATH" "$USERNAME" | ||
30 | exit 1 | ||
31 | fi | ||
32 | |||
33 | # Recursively copy the chosen keyboard's default keymap | ||
34 | cp -r keyboards/"$KB_PATH"/keymaps/default keyboards/"$KB_PATH"/keymaps/"$USERNAME" | ||
35 | |||
36 | printf "%s keymap directory created in: qmk_firmware/keyboards/%s/keymaps/\n\n" "$USERNAME" "$KB_PATH" | ||
37 | |||
38 | printf "Compile a firmware file with your new keymap by typing: \n" | ||
39 | printf " make %s:%s\n" "$KB_PATH" "$USERNAME" | ||
40 | printf "from the qmk_firmware directory\n" | ||