diff --git a/builddefs/build_keyboard.mk b/builddefs/build_keyboard.mk index 91c9541be59..0425d3fc9d7 100644 --- a/builddefs/build_keyboard.mk +++ b/builddefs/build_keyboard.mk @@ -343,6 +343,15 @@ $(KEYBOARD_OUTPUT)/src/default_keyboard.h: $(INFO_JSON_FILES) generated-files: $(KEYBOARD_OUTPUT)/src/info_config.h $(KEYBOARD_OUTPUT)/src/default_keyboard.c $(KEYBOARD_OUTPUT)/src/default_keyboard.h +generated-files: $(KEYMAP_OUTPUT)/src/info_deps.d + +$(KEYMAP_OUTPUT)/src/info_deps.d: + @$(SILENT) || printf "$(MSG_GENERATING) $@" | $(AWK_CMD) + $(eval CMD=$(QMK_BIN) generate-make-dependencies -kb $(KEYBOARD) -km $(KEYMAP) -o $(KEYMAP_OUTPUT)/src/info_deps.d) + @$(BUILD_CMD) + +-include $(KEYMAP_OUTPUT)/src/info_deps.d + .INTERMEDIATE : generated-files # Userspace setup and definitions diff --git a/keyboards/hazel/bad_wings/keymaps/default/keymap.c b/keyboards/hazel/bad_wings/keymaps/default/keymap.c deleted file mode 100644 index e9adc7cc2e9..00000000000 --- a/keyboards/hazel/bad_wings/keymaps/default/keymap.c +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2023 Jason Hazel (@jasonhazel) -// SPDX-License-Identifier: GPL-3.0-or-later - -#include QMK_KEYBOARD_H - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, 1, 2, 3); -} - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_split_3x5_3( - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ - KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, \ - KC_Z, LGUI_T(KC_X), LALT_T(KC_C), KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ - KC_LCTL, OSL(1), OSM(MOD_LSFT), KC_SPC, LT(2, KC_BSPC), KC_ENT - ), - [1] = LAYOUT_split_3x5_3( - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_RBRC, KC_RCBR, KC_RPRN, KC_RABK, KC_NO, \ - KC_GRV, KC_TILD, KC_UNDS, KC_EQL, KC_NO, KC_LBRC, KC_LCBR, KC_LPRN, KC_LABK, KC_BACKSLASH, \ - KC_NO, KC_NO, KC_PLUS, KC_MINS, KC_NO, KC_NO, KC_NO, KC_COLN, KC_DOT, KC_SCLN, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), - [2] = LAYOUT_split_3x5_3( - KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_PIPE, KC_NO, \ - KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, \ - KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DOT, KC_NO, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), - [3] = LAYOUT_split_3x5_3( - KC_ESC, KC_F1, KC_F4, KC_F7, KC_F10, KC_NO, KC_HOME, KC_UP, KC_END, KC_BSPC, \ - KC_TAB, KC_F2, KC_F5, KC_F8, KC_F11, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT, KC_ENT, \ - KC_NO, KC_F3, KC_F6, KC_F9, KC_F12, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_DEL, \ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ) -}; \ No newline at end of file diff --git a/keyboards/hazel/bad_wings/keymaps/default/keymap.json b/keyboards/hazel/bad_wings/keymaps/default/keymap.json new file mode 100644 index 00000000000..670506eaf61 --- /dev/null +++ b/keyboards/hazel/bad_wings/keymaps/default/keymap.json @@ -0,0 +1,163 @@ +{ + "version": 1, + "notes": "", + "documentation": "", + "keyboard": "hazel/bad_wings", + "keymap": "default", + "layout": "LAYOUT_split_3x5_3", + "layers": [ + [ + "KC_Q", + "KC_W", + "KC_E", + "KC_R", + "KC_T", + "KC_Y", + "KC_U", + "KC_I", + "KC_O", + "KC_P", + "KC_A", + "KC_S", + "KC_D", + "KC_F", + "KC_G", + "KC_H", + "KC_J", + "KC_K", + "KC_L", + "KC_QUOT", + "KC_Z", + "LGUI_T(KC_X)", + "LALT_T(KC_C)", + "KC_V", + "KC_B", + "KC_N", + "KC_M", + "KC_COMM", + "KC_DOT", + "KC_SLSH", + "KC_LCTL", + "OSL(1)", + "OSM(MOD_LSFT)", + "LT(3,KC_SPC)", + "LT(2,KC_BSPC)", + "KC_ENT" + ], + [ + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_RBRC", + "KC_RCBR", + "KC_RPRN", + "KC_GT", + "KC_NO", + "KC_GRV", + "KC_TILD", + "KC_UNDS", + "KC_EQL", + "KC_NO", + "KC_LBRC", + "KC_LCBR", + "KC_LPRN", + "KC_LT", + "KC_BSLS", + "KC_NO", + "KC_NO", + "KC_PLUS", + "KC_MINS", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_COLN", + "KC_DOT", + "KC_SCLN", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_EXLM", + "KC_AT", + "KC_HASH", + "KC_DLR", + "KC_PERC", + "KC_CIRC", + "KC_AMPR", + "KC_ASTR", + "KC_PIPE", + "KC_NO", + "KC_1", + "KC_2", + "KC_3", + "KC_4", + "KC_5", + "KC_6", + "KC_7", + "KC_8", + "KC_9", + "KC_0", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_NO", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ], + [ + "KC_ESC", + "KC_F1", + "KC_F4", + "KC_F7", + "KC_F10", + "KC_NO", + "KC_HOME", + "KC_UP", + "KC_END", + "KC_NO", + "KC_TAB", + "KC_F2", + "KC_F5", + "KC_F8", + "KC_F11", + "KC_NO", + "KC_LEFT", + "KC_DOWN", + "KC_RGHT", + "KC_NO", + "KC_NO", + "KC_F3", + "KC_F6", + "KC_F9", + "KC_F12", + "KC_NO", + "KC_MRWD", + "KC_MPLY", + "KC_MFFD", + "KC_DEL", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS", + "KC_TRNS" + ] + ], + "author": "Jason Hazel" +} \ No newline at end of file diff --git a/keyboards/hazel/bad_wings/keymaps/jasonhazel/config.h b/keyboards/hazel/bad_wings/keymaps/jasonhazel/config.h new file mode 100644 index 00000000000..035419eee68 --- /dev/null +++ b/keyboards/hazel/bad_wings/keymaps/jasonhazel/config.h @@ -0,0 +1,17 @@ +// Copyright 2023 Jason Hazel (@jasonhazel) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#define TAPPING_TERM 200 +#define PERMISSIVE_HOLD +#define IGNORE_MOD_TAP_INTERRUPT +#define TAPPING_FORCE_HOLD +#define TAPPING_TERM_PER_KEY +#define ONESHOT_TAP_TOGGLE 10 +#define ONESHOT_TIMEOUT 500 +#define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD +#define CIRQUE_PINNACLE_TAP_ENABLE +#define CIRQUE_PINNACLE_POSITION_MODE CIRQUE_PINNACLE_ABSOLUTE_MODE + +#define POINTING_DEVICE_GESTURES_SCROLL_ENABLE \ No newline at end of file diff --git a/keyboards/hazel/bad_wings/keymaps/jasonhazel/keymap.c b/keyboards/hazel/bad_wings/keymaps/jasonhazel/keymap.c new file mode 100644 index 00000000000..0c3d9c70afa --- /dev/null +++ b/keyboards/hazel/bad_wings/keymaps/jasonhazel/keymap.c @@ -0,0 +1,118 @@ +// Copyright 2023 Jason Hazel (@jasonhazel) +// SPDX-License-Identifier: GPL-3.0-or-later + +#include QMK_KEYBOARD_H + +enum layers { + _ALPHA, + _SYMBOL, + _NUMBER, + _NAVIGATION, + LAYER_LENGTH +}; + + +enum tapdances { + TD_QESC, + TD_SBKT, + TD_CBKT, + TD_PARN, + TD_LTGT, + TD_ATAB, + TAPDANCE_LENGTH +}; + +enum combos { + COMBO_NAVIGATION, + COMBO_LENGTH +}; + + +// begin tapdances +#define KC_QESC TD(TD_QESC) +#define KC_SBKT TD(TD_SBKT) +#define KC_CBKT TD(TD_CBKT) +#define KC_PARN TD(TD_PARN) +#define KC_LTGT TD(TD_LTGT) +#define KC_ATAB TD(TD_ATAB) + +#define KC_GUIX LGUI_T(KC_X) +#define KC_ALTC LALT_T(KC_C) + +// oneshots +#define KC_OSFT OSM(MOD_LSFT) +#define KC_OALT OSM(MOD_LALT) + +// layer changing +#define KC_OSYM OSL(_SYMBOL) +#define KC_ONUM LT(_NUMBER, KC_BSPC) + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch(keycode) { + case KC_GUIX: + case KC_ALTC: + return TAPPING_TERM * 2; + default: + return TAPPING_TERM; + } +} + +// tapdances +tap_dance_action_t tap_dance_actions[] = { + [TD_QESC] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC), + [TD_SBKT] = ACTION_TAP_DANCE_DOUBLE(KC_LBRC, KC_RBRC), + [TD_CBKT] = ACTION_TAP_DANCE_DOUBLE(KC_LCBR, KC_RCBR), + [TD_PARN] = ACTION_TAP_DANCE_DOUBLE(KC_LPRN, KC_RPRN), + [TD_LTGT] = ACTION_TAP_DANCE_DOUBLE(KC_LABK, KC_RABK), + [TD_ATAB] = ACTION_TAP_DANCE_DOUBLE(KC_A, KC_TAB) +}; +// end tapdances + +uint16_t COMBO_LEN = COMBO_LENGTH; + +const uint16_t PROGMEM combo_navigation[] = { KC_OSYM, KC_ONUM, COMBO_END }; +combo_t key_combos[] = { + [COMBO_NAVIGATION] = COMBO(combo_navigation, OSL(_NAVIGATION)), +}; + +uint16_t get_combo_term(uint16_t index, combo_t *combo) { + switch(index) { + case COMBO_NAVIGATION: // extending the combo term here helps reduce sticky layers some more. + return 250; + default: + return COMBO_TERM; + } +} +// end combos + + +// begin layers +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_ALPHA] = LAYOUT_split_3x5_3( + KC_QESC, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, + KC_Z, KC_GUIX, KC_ALTC, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + KC_LCTL, KC_OSYM, KC_OSFT, KC_SPC, KC_ONUM, KC_ENT + ), + [_SYMBOL] = LAYOUT_split_3x5_3( + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_PIPE, KC_NO, + KC_GRV, KC_TILD, KC_UNDS, KC_EQL, KC_NO, KC_SBKT, KC_CBKT, KC_PARN, KC_LTGT, KC_BACKSLASH, + KC_NO, KC_NO, KC_PLUS, KC_MINS, KC_NO, KC_NO, KC_NO, KC_COLN, KC_DOT, KC_SCLN, + KC_LCTL, KC_OSYM, KC_OSFT, KC_SPC, KC_ONUM, KC_ENT + ), + [_NUMBER] = LAYOUT_split_3x5_3( + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_DOT, KC_NO, + KC_LCTL, KC_OSYM, KC_OSFT, KC_SPC, KC_ONUM, KC_ENT + ), + [_NAVIGATION] = LAYOUT_split_3x5_3( + KC_NO, KC_F2, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME, KC_UP, KC_END, KC_BSPC, + KC_TAB, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LEFT, KC_DOWN, KC_RIGHT, KC_ENT, + KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_DEL, + KC_LCTL, KC_OSYM, KC_OSFT, KC_SPC, KC_ONUM, KC_ENT + ) +}; + + + diff --git a/keyboards/hazel/bad_wings/keymaps/jasonhazel/rules.mk b/keyboards/hazel/bad_wings/keymaps/jasonhazel/rules.mk new file mode 100644 index 00000000000..26d76a0df6e --- /dev/null +++ b/keyboards/hazel/bad_wings/keymaps/jasonhazel/rules.mk @@ -0,0 +1,4 @@ +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +COMBO_ENABLE = yes +TAP_DANCE_ENABLE = yes \ No newline at end of file diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index de7b0476a07..9c3decf4f76 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py @@ -57,6 +57,7 @@ subcommands = [ 'qmk.cli.generate.keyboard_h', 'qmk.cli.generate.keycodes', 'qmk.cli.generate.keycodes_tests', + 'qmk.cli.generate.make_dependencies', 'qmk.cli.generate.rgb_breathe_table', 'qmk.cli.generate.rules_mk', 'qmk.cli.generate.version_h', diff --git a/lib/python/qmk/cli/generate/make_dependencies.py b/lib/python/qmk/cli/generate/make_dependencies.py new file mode 100755 index 00000000000..635c341897b --- /dev/null +++ b/lib/python/qmk/cli/generate/make_dependencies.py @@ -0,0 +1,56 @@ +"""Used by the make system to generate dependency lists for each of the generated files. +""" +from pathlib import Path +from milc import cli + +from argcomplete.completers import FilesCompleter + +from qmk.commands import dump_lines +from qmk.constants import QMK_FIRMWARE +from qmk.keyboard import keyboard_completer, keyboard_folder +from qmk.keymap import keymap_completer, locate_keymap +from qmk.path import normpath, FileType + + +@cli.argument('filename', nargs='?', arg_only=True, type=FileType('r'), completer=FilesCompleter('.json'), help='A configurator export JSON.') +@cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') +@cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") +@cli.argument('-kb', '--keyboard', type=keyboard_folder, completer=keyboard_completer, required=True, help='Keyboard to generate dependency file for.') +@cli.argument('-km', '--keymap', completer=keymap_completer, help='The keymap to build a firmware for. Ignored when a configurator export is supplied.') +@cli.subcommand('Generates the list of dependencies associated with a keyboard build and its generated files.', hidden=True) +def generate_make_dependencies(cli): + """Generates the list of dependent info.json, rules.mk, and config.h files for a keyboard. + """ + interesting_files = [ + 'info.json', + 'keymap.json', + 'rules.mk', + 'post_rules.mk', + 'config.h', + 'post_config.h', + ] + + found_files = [] + + # Walk up the keyboard's directory tree looking for the files we're interested in + keyboards_root = Path('keyboards') + parent_path = Path('keyboards') / cli.args.keyboard + while parent_path != keyboards_root: + for file in interesting_files: + test_path = parent_path / file + if test_path.exists(): + found_files.append(test_path) + parent_path = parent_path.parent + + # Find the keymap and include any of the interesting files + if cli.args.keymap is not None: + km = locate_keymap(cli.args.keyboard, cli.args.keymap) + if km is not None: + for file in interesting_files: + found_files.extend(km.parent.glob(f'**/{file}')) + + # If we have a matching userspace, include those too + for file in interesting_files: + found_files.extend((QMK_FIRMWARE / 'users' / cli.args.keymap).glob(f'**/{file}')) + + dump_lines(cli.args.output, [f'generated-files: {found.resolve()}\n' for found in found_files])