diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-28 21:09:31 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-28 21:09:31 +0100 |
commit | 569e1d2c862e213bca257914516aa932ebadf8b9 (patch) | |
tree | 16af67acc00c20edb5c1acc6169c27f78e507bce | |
parent | feat(src): Fmt and enable unicode input (diff) | |
download | qmk_layout-569e1d2c862e213bca257914516aa932ebadf8b9.zip |
fix(src): Add some default stuff
-rwxr-xr-x | build.sh | 85 | ||||
-rw-r--r-- | package.nix | 22 | ||||
-rw-r--r-- | src/config.h | 46 | ||||
-rw-r--r-- | src/keymap.c | 477 | ||||
-rw-r--r-- | src/rules.mk | 2 |
5 files changed, 348 insertions, 284 deletions
diff --git a/build.sh b/build.sh deleted file mode 100755 index 51ecb7a..0000000 --- a/build.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env sh - -set -e - -# Moonlander Layout -# -# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: AGPL-3.0-or-later -# -# This file is part of Moonlander Layout. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/agpl.txt>. - -LAYOUT_ID="KWBYA" -LAYOUT_GEOMETRY="moonlander" - -# # Download layout source -# data="$(mktemp)" -# echo -# cat <<EOF >"$data" -# { "query": "query getLayout(\$hashId: String!, \$revisionId: String!, \$geometry: String) {layout(hashId: \$hashId, geometry: \$geometry, revisionId: \$revisionId) { revision { hashId, qmkVersion, title }}}","variables":{"hashId":"$LAYOUT_ID","geometry":"$LAYOUT_GEOMETRY","revisionId":"latest"}} -# EOF -# -# response="$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data "$(cat "$data")" | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]')" -# -# hash_id="$(echo "${response}" | jq -r '.[0]')" -# firmware_version=$(printf "%.0f" "$(echo "${response}" | jq -r '.[1]')") -# change_description=$(echo "${response}" | jq -r '.[2]') -# if [ -z "${change_description}" ]; then -# change_description="latest layout modification made with Oryx" -# fi -# -# curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip -# -# # Unzip the source file -# unzip -oj source.zip '*_source/*' -d "$LAYOUT_ID" -# rm source.zip -# -# # Commit and Push changes -# git config --local user.name "github-actions" -# git config --local user.email "github-actions@github.com" -# git add . -# git commit -m "✨(oryx): $change_description" || echo "No layout change" -# git push -# -# # Merge Oryx with custom QMK -# git fetch origin main -# git checkout -B main origin/main -# git merge -Xignore-all-space oryx -# git push -# -# # Checkout the right firmware branch -# cd qmk_firmware -# git submodule update --init --remote -# git fetch origin "firmware$firmware_version" -# git checkout -B "firmware$firmware_version" "origin/firmware$firmware_version" -# git submodule update --init --recursive -# -# # Build qmk docker image -# docker build -t qmk . - -# # Build the layout -# ## Set keyboard directory and make prefix based on firmware version -# if [ "$firmware_version" -ge 24 ]; then -# keyboard_directory="qmk_firmware/keyboards/zsa" -# make_prefix="zsa/" -# else -# keyboard_directory="qmk_firmware/keyboards" -# make_prefix="" -# fi -# -# ## Copy layout files to the qmk folder -# rm -rf ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps/$LAYOUT_ID -# mkdir -p ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps && cp -r $LAYOUT_ID ${keyboard_directory}/$LAYOUT_GEOMETRY/keymaps - -## Build the layout -docker run -v ./qmk_firmware:/root --rm qmk /bin/sh -c " - qmk setup zsa/qmk_firmware -b 'firmware$firmware_version' -y - make ${make_prefix}$LAYOUT_GEOMETRY:$LAYOUT_ID -" - -## Find and export built layout -normalized_layout_geometry="$(echo "$LAYOUT_GEOMETRY" | sed 's/\//_/g')" -built_layout_file="$(find ./qmk_firmware -maxdepth 1 -type f -regex ".*${normalized_layout_geometry}.*\.\(bin\|hex\)$")" diff --git a/package.nix b/package.nix index 807a57c..8cde8bf 100644 --- a/package.nix +++ b/package.nix @@ -4,10 +4,11 @@ # deps qmk, gnumake, + git, }: let layout_id = "KWBYA"; layout_geometry = "moonlander"; - FIRMWARE_VERSION = "24"; + firmware_version = "24"; in stdenv.mkDerivation { @@ -15,16 +16,20 @@ in version = "25"; src = fetchgit { - url = "https://github.com/zsa/qmk_firmware"; - rev = "4ae6ea9679fbd4277caa1036d326ddfce278b4d2"; # 2024-12-09T17:43:04 CET - hash = "sha256-c+fojw64dHIYoO20cO9Nd1pnQwBDPPbrh6Erf9QTyGw="; + url = "https://github.com/qmk/qmk_firmware/"; + rev = "refs/tags/0.27.1"; + hash = "sha256-Chq4R8rICY1eyt5r2dkPm34zDOm6TqPKAXQWPp0nByA="; fetchSubmodules = true; + + # This allows for a compiled in version + leaveDotGit = true; }; nativeBuildInputs = [ gnumake qmk + git ]; buildPhase = @@ -35,7 +40,7 @@ in runHook preBuild ## Set keyboard directory and make prefix based on firmware version - if [ "${FIRMWARE_VERSION}" -ge 24 ]; then + if [ "${firmware_version}" -ge 24 ]; then keyboard_directory="keyboards/zsa" keyboard_folder="zsa/${layout_geometry}" else @@ -51,7 +56,6 @@ in cp --recursive "${./src}" "$key_dir" ## Build the layout - # qmk setup "zsa/qmk_firmware" -b 'firmware${FIRMWARE_VERSION}' -y make "$keyboard_folder:${layout_id}" runHook postBuild @@ -60,7 +64,11 @@ in runHook preInstall mkdir --parents "$out/binary_output" - cp "./.build/zsa_moonlander_${layout_id}.bin" "$out/binary_output/" + + cp --recursive "./.build" "$out/build" + rm --recursive "$out/build/obj_zsa_moonlander_${layout_id}" + + ln --symbolic --relative "$out/build/zsa_moonlander_${layout_id}.bin" "$out/binary_output/" runHook postInstall ''; diff --git a/src/config.h b/src/config.h index 7b3ae17..240867c 100644 --- a/src/config.h +++ b/src/config.h @@ -1,3 +1,4 @@ +// LTeX: language=off /* * Moonlander Layout * @@ -12,7 +13,8 @@ /* Set any config.h overrides for your specific keymap here. - See config.h options at https://docs.qmk.fm/#/config_options?id=the-configh-file + See config.h options at + https://docs.qmk.fm/#/config_options?id=the-configh-file */ #undef DEBOUNCE @@ -24,3 +26,45 @@ #define RGB_MATRIX_STARTUP_SPD 60 #define UNICODE_SELECTED_MODES UNICODE_MODE_LINUX + +// Mouse Key section {{{ +/* Delay between pressing a movement key and cursor movement */ +#undef MOUSEKEY_DELAY +#define MOUSEKEY_DELAY 0 // default: 10 + +/* Time between cursor movements in milliseconds */ +#undef MOUSEKEY_INTERVAL +#define MOUSEKEY_INTERVAL 20 // default: 20 + +/* Step size */ +// #undef MOUSEKEY_MOVE_DELTA +// #define MOUSEKEY_MOVE_DELTA 18 // default: 8 + +/* Maximum cursor speed at which acceleration stops */ +#undef MOUSEKEY_MAX_SPEED +#define MOUSEKEY_MAX_SPEED 14 // default: 10 + +/* Time until maximum cursor speed is reached */ +#undef MOUSEKEY_TIME_TO_MAX +#define MOUSEKEY_TIME_TO_MAX 60 // default: 30 + +/* Delay between pressing a wheel key and wheel movement */ +#undef MOUSEKEY_WHEEL_DELAY +#define MOUSEKEY_WHEEL_DELAY 0 // default: 10 + +/* Time between wheel movements */ +#undef MOUSEKEY_WHEEL_INTERVAL +#define MOUSEKEY_WHEEL_INTERVAL 80 // default: 80 + +/* Wheel movement step size */ +#undef MOUSEKEY_WHEEL_DELTA +#define MOUSEKEY_WHEEL_DELTA 3 // default: 1 + +/* Maximum number of scroll steps per scroll action */ +#undef MOUSEKEY_WHEEL_MAX_SPEED +#define MOUSEKEY_WHEEL_MAX_SPEED 8 // default: 8 + +/* Time until maximum scroll speed is reached */ +#undef MOUSEKEY_WHEEL_TIME_TO_MAX +#define MOUSEKEY_WHEEL_TIME_TO_MAX 60 // default: 40 +// }}} diff --git a/src/keymap.c b/src/keymap.c index ff6eaed..35b6d5d 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -27,8 +27,6 @@ enum custom_keycodes { ST_MACRO_7, }; - - enum tap_dance_codes { DANCE_0, DANCE_1, @@ -37,6 +35,7 @@ enum tap_dance_codes { DANCE_4, }; +// clang-format off const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT_moonlander( KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, QK_BOOT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, @@ -79,12 +78,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT ), [5] = LAYOUT_moonlander( - KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, - KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN2, KC_MS_BTN3, KC_MS_BTN1, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, KC_TRANSPARENT, KC_TRANSPARENT, - KC_TRANSPARENT, KC_MS_WH_UP, KC_MS_WH_UP, KC_MS_WH_DOWN, KC_MS_WH_LEFT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, KC_TRANSPARENT, - KC_TRANSPARENT, LCTL(LSFT(KC_TAB)),LALT(LCTL(KC_R)),LCTL(KC_T), LCTL(KC_TAB), KC_TRANSPARENT, KC_TRANSPARENT, KC_WWW_BACK, KC_TRANSPARENT, KC_WWW_HOME, KC_WWW_FORWARD, KC_TRANSPARENT, - KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, - KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, QK_BOOT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN2, KC_MS_BTN3, KC_MS_BTN1, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_MS_WH_UP, QK_MOUSE_WHEEL_UP, QK_MOUSE_WHEEL_DOWN, KC_MS_WH_LEFT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, KC_TRANSPARENT, + KC_TRANSPARENT, LCTL(LSFT(KC_TAB)), LALT(LCTL(KC_R)), LCTL(KC_T), LCTL(KC_TAB), KC_TRANSPARENT, KC_TRANSPARENT, KC_WWW_BACK, KC_TRANSPARENT, KC_WWW_HOME, KC_WWW_FORWARD, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, + KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT ), [6] = LAYOUT_moonlander( KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, @@ -119,14 +118,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT ), }; +// clang-format on extern rgb_config_t rgb_matrix_config; -void keyboard_post_init_user(void) { - rgb_matrix_enable(); -} - +void keyboard_post_init_user(void) { rgb_matrix_enable(); } +// clang-format off const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = { [0] = { {0,255,255}, {86,255,128}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {43,255,255}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {0,255,255}, {27,255,255}, {27,255,255}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0}, {0,255,255}, {86,255,128}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {43,255,255}, {172,255,255}, {215,255,128}, {0,255,255}, {27,255,255}, {86,255,128}, {172,255,255}, {0,255,255}, {27,255,255}, {27,255,255}, {0,245,245}, {0,245,245}, {0,245,245}, {0,0,0} }, @@ -147,60 +145,62 @@ const uint8_t PROGMEM ledmap[][RGB_MATRIX_LED_COUNT][3] = { [8] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {215,255,128}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, [9] = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {131,255,255}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, - }; +// clang-format on void set_layer_color(int layer) { for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) { HSV hsv = { - .h = pgm_read_byte(&ledmap[layer][i][0]), - .s = pgm_read_byte(&ledmap[layer][i][1]), - .v = pgm_read_byte(&ledmap[layer][i][2]), + .h = pgm_read_byte(&ledmap[layer][i][0]), + .s = pgm_read_byte(&ledmap[layer][i][1]), + .v = pgm_read_byte(&ledmap[layer][i][2]), }; if (!hsv.h && !hsv.s && !hsv.v) { - rgb_matrix_set_color( i, 0, 0, 0 ); + rgb_matrix_set_color(i, 0, 0, 0); } else { - RGB rgb = hsv_to_rgb( hsv ); - float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; - rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b ); + RGB rgb = hsv_to_rgb(hsv); + float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX; + rgb_matrix_set_color(i, f * rgb.r, f * rgb.g, f * rgb.b); } } } bool rgb_matrix_indicators_user(void) { - if (keyboard_config.disable_layer_led) { return false; } + if (keyboard_config.disable_layer_led) { + return false; + } switch (biton32(layer_state)) { - case 0: - set_layer_color(0); - break; - case 1: - set_layer_color(1); - break; - case 2: - set_layer_color(2); - break; - case 3: - set_layer_color(3); - break; - case 4: - set_layer_color(4); - break; - case 5: - set_layer_color(5); - break; - case 6: - set_layer_color(6); - break; - case 7: - set_layer_color(7); - break; - case 8: - set_layer_color(8); - break; - case 9: - set_layer_color(9); - break; - default: + case 0: + set_layer_color(0); + break; + case 1: + set_layer_color(1); + break; + case 2: + set_layer_color(2); + break; + case 3: + set_layer_color(3); + break; + case 4: + set_layer_color(4); + break; + case 5: + set_layer_color(5); + break; + case 6: + set_layer_color(6); + break; + case 7: + set_layer_color(7); + break; + case 8: + set_layer_color(8); + break; + case 9: + set_layer_color(9); + break; + default: if (rgb_matrix_get_flags() == LED_FLAG_NONE) rgb_matrix_set_color_all(0, 0, 0); break; @@ -208,6 +208,7 @@ bool rgb_matrix_indicators_user(void) { return true; } +// clang-format off bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case ST_MACRO_0: @@ -259,20 +260,20 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; } - +// clang-format on typedef struct { - bool is_press_action; - uint8_t step; + bool is_press_action; + uint8_t step; } tap; enum { - SINGLE_TAP = 1, - SINGLE_HOLD, - DOUBLE_TAP, - DOUBLE_HOLD, - DOUBLE_SINGLE_TAP, - MORE_TAPS + SINGLE_TAP = 1, + SINGLE_HOLD, + DOUBLE_TAP, + DOUBLE_HOLD, + DOUBLE_SINGLE_TAP, + MORE_TAPS }; static tap dance_state[5]; @@ -280,198 +281,292 @@ static tap dance_state[5]; uint8_t dance_step(tap_dance_state_t *state); uint8_t dance_step(tap_dance_state_t *state) { - if (state->count == 1) { - if (state->interrupted || !state->pressed) return SINGLE_TAP; - else return SINGLE_HOLD; - } else if (state->count == 2) { - if (state->interrupted) return DOUBLE_SINGLE_TAP; - else if (state->pressed) return DOUBLE_HOLD; - else return DOUBLE_TAP; - } - return MORE_TAPS; + if (state->count == 1) { + if (state->interrupted || !state->pressed) + return SINGLE_TAP; + else + return SINGLE_HOLD; + } else if (state->count == 2) { + if (state->interrupted) + return DOUBLE_SINGLE_TAP; + else if (state->pressed) + return DOUBLE_HOLD; + else + return DOUBLE_TAP; + } + return MORE_TAPS; } - void on_dance_0(tap_dance_state_t *state, void *user_data); void dance_0_finished(tap_dance_state_t *state, void *user_data); void dance_0_reset(tap_dance_state_t *state, void *user_data); void on_dance_0(tap_dance_state_t *state, void *user_data) { - if(state->count == 3) { - tap_code16(KC_SCLN); - tap_code16(KC_SCLN); - tap_code16(KC_SCLN); - } - if(state->count > 3) { - tap_code16(KC_SCLN); - } + if (state->count == 3) { + tap_code16(KC_SCLN); + tap_code16(KC_SCLN); + tap_code16(KC_SCLN); + } + if (state->count > 3) { + tap_code16(KC_SCLN); + } } void dance_0_finished(tap_dance_state_t *state, void *user_data) { - dance_state[0].step = dance_step(state); - switch (dance_state[0].step) { - case SINGLE_TAP: register_code16(KC_SCLN); break; - case SINGLE_HOLD: register_code16(KC_COLN); break; - case DOUBLE_TAP: register_code16(KC_SCLN); register_code16(KC_SCLN); break; - case DOUBLE_SINGLE_TAP: tap_code16(KC_SCLN); register_code16(KC_SCLN); - } + dance_state[0].step = dance_step(state); + switch (dance_state[0].step) { + case SINGLE_TAP: + register_code16(KC_SCLN); + break; + case SINGLE_HOLD: + register_code16(KC_COLN); + break; + case DOUBLE_TAP: + register_code16(KC_SCLN); + register_code16(KC_SCLN); + break; + case DOUBLE_SINGLE_TAP: + tap_code16(KC_SCLN); + register_code16(KC_SCLN); + } } void dance_0_reset(tap_dance_state_t *state, void *user_data) { - wait_ms(10); - switch (dance_state[0].step) { - case SINGLE_TAP: unregister_code16(KC_SCLN); break; - case SINGLE_HOLD: unregister_code16(KC_COLN); break; - case DOUBLE_TAP: unregister_code16(KC_SCLN); break; - case DOUBLE_SINGLE_TAP: unregister_code16(KC_SCLN); break; - } - dance_state[0].step = 0; + wait_ms(10); + switch (dance_state[0].step) { + case SINGLE_TAP: + unregister_code16(KC_SCLN); + break; + case SINGLE_HOLD: + unregister_code16(KC_COLN); + break; + case DOUBLE_TAP: + unregister_code16(KC_SCLN); + break; + case DOUBLE_SINGLE_TAP: + unregister_code16(KC_SCLN); + break; + } + dance_state[0].step = 0; } void on_dance_1(tap_dance_state_t *state, void *user_data); void dance_1_finished(tap_dance_state_t *state, void *user_data); void dance_1_reset(tap_dance_state_t *state, void *user_data); void on_dance_1(tap_dance_state_t *state, void *user_data) { - if(state->count == 3) { - tap_code16(KC_SLASH); - tap_code16(KC_SLASH); - tap_code16(KC_SLASH); - } - if(state->count > 3) { - tap_code16(KC_SLASH); - } + if (state->count == 3) { + tap_code16(KC_SLASH); + tap_code16(KC_SLASH); + tap_code16(KC_SLASH); + } + if (state->count > 3) { + tap_code16(KC_SLASH); + } } void dance_1_finished(tap_dance_state_t *state, void *user_data) { - dance_state[1].step = dance_step(state); - switch (dance_state[1].step) { - case SINGLE_TAP: register_code16(KC_SLASH); break; - case SINGLE_HOLD: register_code16(KC_BSLS); break; - case DOUBLE_TAP: register_code16(KC_SLASH); register_code16(KC_SLASH); break; - case DOUBLE_SINGLE_TAP: tap_code16(KC_SLASH); register_code16(KC_SLASH); - } + dance_state[1].step = dance_step(state); + switch (dance_state[1].step) { + case SINGLE_TAP: + register_code16(KC_SLASH); + break; + case SINGLE_HOLD: + register_code16(KC_BSLS); + break; + case DOUBLE_TAP: + register_code16(KC_SLASH); + register_code16(KC_SLASH); + break; + case DOUBLE_SINGLE_TAP: + tap_code16(KC_SLASH); + register_code16(KC_SLASH); + } } void dance_1_reset(tap_dance_state_t *state, void *user_data) { - wait_ms(10); - switch (dance_state[1].step) { - case SINGLE_TAP: unregister_code16(KC_SLASH); break; - case SINGLE_HOLD: unregister_code16(KC_BSLS); break; - case DOUBLE_TAP: unregister_code16(KC_SLASH); break; - case DOUBLE_SINGLE_TAP: unregister_code16(KC_SLASH); break; - } - dance_state[1].step = 0; + wait_ms(10); + switch (dance_state[1].step) { + case SINGLE_TAP: + unregister_code16(KC_SLASH); + break; + case SINGLE_HOLD: + unregister_code16(KC_BSLS); + break; + case DOUBLE_TAP: + unregister_code16(KC_SLASH); + break; + case DOUBLE_SINGLE_TAP: + unregister_code16(KC_SLASH); + break; + } + dance_state[1].step = 0; } void on_dance_2(tap_dance_state_t *state, void *user_data); void dance_2_finished(tap_dance_state_t *state, void *user_data); void dance_2_reset(tap_dance_state_t *state, void *user_data); void on_dance_2(tap_dance_state_t *state, void *user_data) { - if(state->count == 3) { - tap_code16(KC_MINUS); - tap_code16(KC_MINUS); - tap_code16(KC_MINUS); - } - if(state->count > 3) { - tap_code16(KC_MINUS); - } + if (state->count == 3) { + tap_code16(KC_MINUS); + tap_code16(KC_MINUS); + tap_code16(KC_MINUS); + } + if (state->count > 3) { + tap_code16(KC_MINUS); + } } void dance_2_finished(tap_dance_state_t *state, void *user_data) { - dance_state[2].step = dance_step(state); - switch (dance_state[2].step) { - case SINGLE_TAP: register_code16(KC_MINUS); break; - case SINGLE_HOLD: register_code16(KC_UNDS); break; - case DOUBLE_TAP: register_code16(KC_MINUS); register_code16(KC_MINUS); break; - case DOUBLE_SINGLE_TAP: tap_code16(KC_MINUS); register_code16(KC_MINUS); - } + dance_state[2].step = dance_step(state); + switch (dance_state[2].step) { + case SINGLE_TAP: + register_code16(KC_MINUS); + break; + case SINGLE_HOLD: + register_code16(KC_UNDS); + break; + case DOUBLE_TAP: + register_code16(KC_MINUS); + register_code16(KC_MINUS); + break; + case DOUBLE_SINGLE_TAP: + tap_code16(KC_MINUS); + register_code16(KC_MINUS); + } } void dance_2_reset(tap_dance_state_t *state, void *user_data) { - wait_ms(10); - switch (dance_state[2].step) { - case SINGLE_TAP: unregister_code16(KC_MINUS); break; - case SINGLE_HOLD: unregister_code16(KC_UNDS); break; - case DOUBLE_TAP: unregister_code16(KC_MINUS); break; - case DOUBLE_SINGLE_TAP: unregister_code16(KC_MINUS); break; - } - dance_state[2].step = 0; + wait_ms(10); + switch (dance_state[2].step) { + case SINGLE_TAP: + unregister_code16(KC_MINUS); + break; + case SINGLE_HOLD: + unregister_code16(KC_UNDS); + break; + case DOUBLE_TAP: + unregister_code16(KC_MINUS); + break; + case DOUBLE_SINGLE_TAP: + unregister_code16(KC_MINUS); + break; + } + dance_state[2].step = 0; } void on_dance_3(tap_dance_state_t *state, void *user_data); void dance_3_finished(tap_dance_state_t *state, void *user_data); void dance_3_reset(tap_dance_state_t *state, void *user_data); void on_dance_3(tap_dance_state_t *state, void *user_data) { - if(state->count == 3) { - tap_code16(KC_QUOTE); - tap_code16(KC_QUOTE); - tap_code16(KC_QUOTE); - } - if(state->count > 3) { - tap_code16(KC_QUOTE); - } + if (state->count == 3) { + tap_code16(KC_QUOTE); + tap_code16(KC_QUOTE); + tap_code16(KC_QUOTE); + } + if (state->count > 3) { + tap_code16(KC_QUOTE); + } } void dance_3_finished(tap_dance_state_t *state, void *user_data) { - dance_state[3].step = dance_step(state); - switch (dance_state[3].step) { - case SINGLE_TAP: register_code16(KC_QUOTE); break; - case SINGLE_HOLD: register_code16(KC_DQUO); break; - case DOUBLE_TAP: register_code16(KC_QUOTE); register_code16(KC_QUOTE); break; - case DOUBLE_SINGLE_TAP: tap_code16(KC_QUOTE); register_code16(KC_QUOTE); - } + dance_state[3].step = dance_step(state); + switch (dance_state[3].step) { + case SINGLE_TAP: + register_code16(KC_QUOTE); + break; + case SINGLE_HOLD: + register_code16(KC_DQUO); + break; + case DOUBLE_TAP: + register_code16(KC_QUOTE); + register_code16(KC_QUOTE); + break; + case DOUBLE_SINGLE_TAP: + tap_code16(KC_QUOTE); + register_code16(KC_QUOTE); + } } void dance_3_reset(tap_dance_state_t *state, void *user_data) { - wait_ms(10); - switch (dance_state[3].step) { - case SINGLE_TAP: unregister_code16(KC_QUOTE); break; - case SINGLE_HOLD: unregister_code16(KC_DQUO); break; - case DOUBLE_TAP: unregister_code16(KC_QUOTE); break; - case DOUBLE_SINGLE_TAP: unregister_code16(KC_QUOTE); break; - } - dance_state[3].step = 0; + wait_ms(10); + switch (dance_state[3].step) { + case SINGLE_TAP: + unregister_code16(KC_QUOTE); + break; + case SINGLE_HOLD: + unregister_code16(KC_DQUO); + break; + case DOUBLE_TAP: + unregister_code16(KC_QUOTE); + break; + case DOUBLE_SINGLE_TAP: + unregister_code16(KC_QUOTE); + break; + } + dance_state[3].step = 0; } void on_dance_4(tap_dance_state_t *state, void *user_data); void dance_4_finished(tap_dance_state_t *state, void *user_data); void dance_4_reset(tap_dance_state_t *state, void *user_data); void on_dance_4(tap_dance_state_t *state, void *user_data) { - if(state->count == 3) { - tap_code16(KC_EQUAL); - tap_code16(KC_EQUAL); - tap_code16(KC_EQUAL); - } - if(state->count > 3) { - tap_code16(KC_EQUAL); - } + if (state->count == 3) { + tap_code16(KC_EQUAL); + tap_code16(KC_EQUAL); + tap_code16(KC_EQUAL); + } + if (state->count > 3) { + tap_code16(KC_EQUAL); + } } void dance_4_finished(tap_dance_state_t *state, void *user_data) { - dance_state[4].step = dance_step(state); - switch (dance_state[4].step) { - case SINGLE_TAP: register_code16(KC_EQUAL); break; - case SINGLE_HOLD: register_code16(KC_PLUS); break; - case DOUBLE_TAP: register_code16(KC_EQUAL); register_code16(KC_EQUAL); break; - case DOUBLE_SINGLE_TAP: tap_code16(KC_EQUAL); register_code16(KC_EQUAL); - } + dance_state[4].step = dance_step(state); + switch (dance_state[4].step) { + case SINGLE_TAP: + register_code16(KC_EQUAL); + break; + case SINGLE_HOLD: + register_code16(KC_PLUS); + break; + case DOUBLE_TAP: + register_code16(KC_EQUAL); + register_code16(KC_EQUAL); + break; + case DOUBLE_SINGLE_TAP: + tap_code16(KC_EQUAL); + register_code16(KC_EQUAL); + } } void dance_4_reset(tap_dance_state_t *state, void *user_data) { - wait_ms(10); - switch (dance_state[4].step) { - case SINGLE_TAP: unregister_code16(KC_EQUAL); break; - case SINGLE_HOLD: unregister_code16(KC_PLUS); break; - case DOUBLE_TAP: unregister_code16(KC_EQUAL); break; - case DOUBLE_SINGLE_TAP: unregister_code16(KC_EQUAL); break; - } - dance_state[4].step = 0; + wait_ms(10); + switch (dance_state[4].step) { + case SINGLE_TAP: + unregister_code16(KC_EQUAL); + break; + case SINGLE_HOLD: + unregister_code16(KC_PLUS); + break; + case DOUBLE_TAP: + unregister_code16(KC_EQUAL); + break; + case DOUBLE_SINGLE_TAP: + unregister_code16(KC_EQUAL); + break; + } + dance_state[4].step = 0; } tap_dance_action_t tap_dance_actions[] = { - [DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, dance_0_reset), - [DANCE_1] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_1, dance_1_finished, dance_1_reset), - [DANCE_2] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_2, dance_2_finished, dance_2_reset), - [DANCE_3] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_3, dance_3_finished, dance_3_reset), - [DANCE_4] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_4, dance_4_finished, dance_4_reset), + [DANCE_0] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_0, dance_0_finished, + dance_0_reset), + [DANCE_1] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_1, dance_1_finished, + dance_1_reset), + [DANCE_2] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_2, dance_2_finished, + dance_2_reset), + [DANCE_3] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_3, dance_3_finished, + dance_3_reset), + [DANCE_4] = ACTION_TAP_DANCE_FN_ADVANCED(on_dance_4, dance_4_finished, + dance_4_reset), }; diff --git a/src/rules.mk b/src/rules.mk index 282e78b..b1c5823 100644 --- a/src/rules.mk +++ b/src/rules.mk @@ -16,5 +16,7 @@ TAP_DANCE_ENABLE = yes SPACE_CADET_ENABLE = no CAPS_WORD_ENABLE = yes +MOUSEKEY_ENABLE = yes + UNICODE_COMMON = yes UNICODE_ENABLE = yes |