Browse Source

Reverted to Drashna's capsword and rebuilt it for my purposes. Got semicolon tap dance to work better. Added arrow keys to Vim layer to match original Kinesis. And more.'

pull/17056/head
K 2 years ago
parent
commit
cc4088e350
6 changed files with 421 additions and 340 deletions
  1. +166
    -0
      keyboards/kinesis/kint36/keymaps/kevkevco/features/caps_word oldmine.c
  2. +127
    -129
      keyboards/kinesis/kint36/keymaps/kevkevco/features/caps_word.c
  3. +115
    -36
      keyboards/kinesis/kint36/keymaps/kevkevco/keymap.c
  4. +1
    -0
      keyboards/kinesis/kint36/keymaps/kevkevco/my_keycodes.h
  5. +8
    -174
      keyboards/kinesis/kint36/keymaps/kevkevco/readme.md
  6. +4
    -1
      keyboards/kinesis/kint36/keymaps/kevkevco/rules.mk

+ 166
- 0
keyboards/kinesis/kint36/keymaps/kevkevco/features/caps_word oldmine.c View File

@ -0,0 +1,166 @@
// Copyright 2021-2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// For full documentation, see
// https://getreuer.info/posts/keyboards/caps-word
#include "caps_word.h"
static bool caps_word_active = false;
// Many keyboards enable the Command feature, which by default is also activated
// by Left Shift + Right Shift. It can be configured to use a different key
// combination by defining IS_COMMAND(). We make a non-fatal warning if Command
// is enabled but IS_COMMAND() is *not* defined.
#if defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
#pragma message "Caps Word and Command should not be enabled at the same time, since both use the Left Shift + Right Shift key combination. Please disable Command, or ensure that `IS_COMMAND` is not set to (get_mods() == MOD_MASK_SHIFT)."
#endif // defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
#if CAPS_WORD_IDLE_TIMEOUT > 0
#if CAPS_WORD_IDLE_TIMEOUT < 100 || CAPS_WORD_IDLE_TIMEOUT > 30000
// Constrain timeout to a sensible range. With the 16-bit timer, the longest
// representable timeout is 32768 ms, rounded here to 30000 ms = half a minute.
#error "caps_word: CAPS_WORD_IDLE_TIMEOUT must be between 100 and 30000 ms"
#endif
static uint16_t idle_timer = 0;
void caps_word_task(void) {
if (caps_word_active && timer_expired(timer_read(), idle_timer)) {
caps_word_set(false);
}
}
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
#ifndef NO_ACTION_ONESHOT
const uint8_t mods = get_mods() | get_oneshot_mods();
#else
const uint8_t mods = get_mods();
#endif // NO_ACTION_ONESHOT
if (!caps_word_active) {
// Pressing both shift keys at the same time enables caps word.
if ((mods & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) {
caps_word_set(true); // Activate Caps Word.
return false;
}
return true;
} else {
#if CAPS_WORD_IDLE_TIMEOUT > 0
idle_timer = record->event.time + CAPS_WORD_IDLE_TIMEOUT;
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
}
if (!record->event.pressed) { return true; }
if (!(mods & ~MOD_MASK_SHIFT)) { // If both shift mods are active
switch (keycode) {
// Ignore MO, TO, TG, TT, and OSL layer switch keys.
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
case QK_TO ... QK_TO_MAX:
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: // Added by kevkevco to ignore tap dance keys
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: // Added by kevkevco to ignore tap dance keys
set_mods(MOD_MASK_SHIFT); // Added
return true;
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
add_weak_mods(MOD_BIT(KC_LSFT)); // Added by kevkevco (applies shift to the next key)
return true;
#ifndef NO_ACTION_TAPPING
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
if (record->tap.count == 0) {
// Deactivate if a mod becomes active through holding a mod-tap key.
caps_word_set(false);
return true;
}
keycode &= 0xff;
break;
// Section commented out
// #ifndef NO_ACTION_LAYER
// case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
// #endif // NO_ACTION_LAYER
if (record->tap.count == 0) { return true; }
keycode &= 0xff;
break;
#endif // NO_ACTION_TAPPING
#ifdef SWAP_HANDS_ENABLE
case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
if (keycode > 0x56F0 || record->tap.count == 0) { return true; }
keycode &= 0xff;
break;
#endif // SWAP_HANDS_ENABLE
}
// clear_weak_mods(); // Commented out to match Drashna?
if (caps_word_press_user(keycode)) {
// send_keyboard_report(); // Commented out to match Drashna
return true;
}
}
caps_word_set(false); // Deactvate Caps Word.
return true;
}
void caps_word_set(bool active) {
if (active != caps_word_active) {
if (active) {
clear_mods();
#ifndef NO_ACTION_ONESHOT
clear_oneshot_mods();
#endif // NO_ACTION_ONESHOT
#if CAPS_WORD_IDLE_TIMEOUT > 0
idle_timer = timer_read() + CAPS_WORD_IDLE_TIMEOUT;
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
} else {
// Make sure weak shift is off.
unregister_weak_mods(MOD_BIT(KC_LSFT));
}
caps_word_active = active;
caps_word_set_user(active);
}
}
bool caps_word_get(void) { return caps_word_active; }
__attribute__((weak)) void caps_word_set_user(bool active) {}
__attribute__((weak)) bool caps_word_press_user(uint16_t keycode) {
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_A ... KC_Z:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
return true;
case KC_MINS:
clear_mods();
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_UNDS:
case KC_BSPC:
case KC_DEL:
return true;
default:
return false; // Deactivate Caps Word.
}
}

+ 127
- 129
keyboards/kinesis/kint36/keymaps/kevkevco/features/caps_word.c View File

@ -1,167 +1,165 @@
// Copyright 2021-2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
// For full documentation, see
// https://getreuer.info/posts/keyboards/caps-word
#include "caps_word.h"
#include "print.h" // For debugging purposes
static bool caps_word_active = false;
// Many keyboards enable the Command feature, which by default is also activated
// by Left Shift + Right Shift. It can be configured to use a different key
// combination by defining IS_COMMAND(). We make a non-fatal warning if Command
// is enabled but IS_COMMAND() is *not* defined.
#if defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
#pragma message "Caps Word and Command should not be enabled at the same time, since both use the Left Shift + Right Shift key combination. Please disable Command, or ensure that `IS_COMMAND` is not set to (get_mods() == MOD_MASK_SHIFT)."
#endif // defined(COMMAND_ENABLE) && !defined(IS_COMMAND)
#if CAPS_WORD_IDLE_TIMEOUT > 0
#if CAPS_WORD_IDLE_TIMEOUT < 100 || CAPS_WORD_IDLE_TIMEOUT > 30000
# if CAPS_WORD_IDLE_TIMEOUT < 100 || CAPS_WORD_IDLE_TIMEOUT > 30000
// Constrain timeout to a sensible range. With the 16-bit timer, the longest
// representable timeout is 32768 ms, rounded here to 30000 ms = half a minute.
#error "caps_word: CAPS_WORD_IDLE_TIMEOUT must be between 100 and 30000 ms"
#endif
# error "caps_word: CAPS_WORD_IDLE_TIMEOUT must be between 100 and 30000 ms"
# endif
static uint16_t idle_timer = 0;
void caps_word_task(void) {
if (caps_word_active && timer_expired(timer_read(), idle_timer)) {
caps_word_set(false);
}
if (caps_word_active && timer_expired(timer_read(), idle_timer)) {
caps_word_set(false);
}
}
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
#ifndef NO_ACTION_ONESHOT
const uint8_t mods = get_mods() | get_oneshot_mods();
const uint8_t mods = get_mods() | get_oneshot_mods();
#else
const uint8_t mods = get_mods();
#endif // NO_ACTION_ONESHOT
if (!caps_word_active) {
// Pressing both shift keys at the same time enables caps word.
if (mods == MOD_MASK_SHIFT) {
caps_word_set(true); // Activate Caps Word.
return false;
}
return true;
} else {
#if CAPS_WORD_IDLE_TIMEOUT > 0
idle_timer = record->event.time + CAPS_WORD_IDLE_TIMEOUT;
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
}
if (!record->event.pressed) { return true; }
if (!(mods & ~MOD_MASK_SHIFT)) { // Filters for both shift mods must be active
switch (keycode) {
// Ignore MO, TO, TG, TT, and OSL layer switch keys.
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
case QK_TO ... QK_TO_MAX:
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: // Added to ignore tap dance keys
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: // Added to ignore tap dance keys
set_mods(MOD_MASK_SHIFT);
const uint8_t mods = get_mods();
#endif // NO_ACTION_ONESHOT
if (!caps_word_active) {
// Pressing both shift keys at the same time enables caps word.
if ((mods & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) {
caps_word_set(true); // Activate Caps Word.
return false;
}
return true;
} else {
#if CAPS_WORD_IDLE_TIMEOUT > 0
idle_timer = record->event.time + CAPS_WORD_IDLE_TIMEOUT;
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
}
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
if (!record->event.pressed) {
return true;
}
#ifndef NO_ACTION_TAPPING
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
if (record->tap.count == 0) {
// Deactivate if a mod becomes active through holding a mod-tap key.
caps_word_set(false);
return true;
if (!(mods & ~MOD_MASK_SHIFT)) {
uprintf("keycode is %x", keycode);
// Custom section to tweak Caps Word behavior on select keys
if (keycode == 0x782c) {
print("\nspecial specified section?");
return true;
}
keycode &= 0xff;
break;
if (keycode == 0x5709) {
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
print("\nspecial specified section?");
return true;
}
switch (keycode) {
// Ignore MO, TO, TG, TT, and OSL layer switch keys.
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
case QK_TO ... QK_TO_MAX:
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: // Added by kevkevco to ignore tap dance keys
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:
print("\nignore section?");
return true;
// #ifndef NO_ACTION_LAYER
// case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
// #endif // NO_ACTION_LAYER
if (record->tap.count == 0) { return true; }
keycode &= 0xff;
break;
#endif // NO_ACTION_TAPPING
#ifndef NO_ACTION_TAPPING
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
print("\nmodtap section?");
if (record->tap.count == 0) {
print("\ncancelling modtap section?");
// Deactivate if a mod becomes active through holding a mod-tap key.
caps_word_set(false);
return true;
}
keycode &= 0xff;
break;
# ifndef NO_ACTION_LAYER
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
print("\nlayer tap section?");
# endif // NO_ACTION_LAYER
if (record->tap.count == 0) {
return true;
}
keycode &= 0xff;
break;
#endif // NO_ACTION_TAPPING
#ifdef SWAP_HANDS_ENABLE
case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
if (keycode > 0x56F0 || record->tap.count == 0) { return true; }
keycode &= 0xff;
break;
#endif // SWAP_HANDS_ENABLE
}
case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
if (keycode > 0x56F0 || record->tap.count == 0) {
return true;
}
keycode &= 0xff;
break;
#endif // SWAP_HANDS_ENABLE
}
clear_weak_mods();
if (caps_word_press_user(keycode)) {
send_keyboard_report();
return true;
if (caps_word_press_user(keycode)) {
return true;
}
}
}
caps_word_set(false); // Deactvate Caps Word.
return true;
caps_word_set(false); // Deactivate Caps Word.
return true;
}
void caps_word_set(bool active) {
if (active != caps_word_active) {
if (active) {
clear_mods();
if (active != caps_word_active) {
if (active) {
clear_mods();
#ifndef NO_ACTION_ONESHOT
clear_oneshot_mods();
#endif // NO_ACTION_ONESHOT
clear_oneshot_mods();
#endif // NO_ACTION_ONESHOT
#if CAPS_WORD_IDLE_TIMEOUT > 0
idle_timer = timer_read() + CAPS_WORD_IDLE_TIMEOUT;
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
} else {
// Make sure weak shift is off.
unregister_weak_mods(MOD_BIT(KC_LSFT));
}
idle_timer = timer_read() + CAPS_WORD_IDLE_TIMEOUT;
#endif // CAPS_WORD_IDLE_TIMEOUT > 0
} else if ((get_weak_mods() & MOD_BIT(KC_LSFT)) != 0) {
// If the weak shift mod is still on, turn it off and send an update to
// the host computer.
del_weak_mods(MOD_BIT(KC_LSFT));
send_keyboard_report();
}
caps_word_active = active;
caps_word_set_user(active);
}
caps_word_active = active;
caps_word_set_user(active);
}
}
bool caps_word_get(void) { return caps_word_active; }
bool caps_word_get(void) {
return caps_word_active;
}
__attribute__((weak)) void caps_word_set_user(bool active) {}
__attribute__((weak)) bool caps_word_press_user(uint16_t keycode) {
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_A ... KC_Z:
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
return true;
case KC_MINS:
clear_mods();
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_UNDS:
case KC_BSPC:
case KC_DEL:
return true;
default:
return false; // Deactivate Caps Word.
}
}
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_A ... KC_Z:
// case TD(ISPT):
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
print("\nkeycodes that continue CW WITH shifting");
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_BSPC:
case KC_MINS:
case KC_UNDS:
print("\nkeycodes that continue CW without shifting");
return true;
default:
return false; // Deactivate Caps Word.
}
}

+ 115
- 36
keyboards/kinesis/kint36/keymaps/kevkevco/keymap.c View File

@ -22,7 +22,7 @@
#include "features/caps_word.h"
#include "features/num_word.h"
#include "features/select_word.h"
#include "print.h" // For debugging purposes
// For more readable LED control code
#define LED_KEYPAD E26
@ -63,7 +63,6 @@ enum {
};
// Define a type for as many tap dance states as needed
typedef enum {
TD_NONE,
@ -119,7 +118,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* QWERTY/Default Layer
,--------------------------------------------------------------. ,--------------------------------------------------------------.
|ESC^ST|SWAPHD| F2 |QWERTY|NUMSFT|FUNCTN|KEYPAD| NAV | VIM | | CLEAR|MACROP|MACROR|MACROS| Mute | VolDn| VolUp|Keypad| Fn |
|ESC^ST|SWAPHD| F2 |QWERTY|NUMSFT|FUNCTN|KEYPAD| NAV | VIM | | CLEAR|MACROP|MACROR|MACROS| Mute | VolDn| VolUp|Keypad|PROGRM|
`--------------------------------------------------------------' `--------------------------------------------------------------'
,------------------------------------------------------. ,------------------------------------------------------.
| ESC|`\~ | 1^! | 2^@ | 3^# | 4^$ | 5^% | | 6^^ | 7^& | 8^* | 9^( | 0^) | NAV |
@ -130,7 +129,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
| :LSHFT | Z | X | C | V | B | | N | M | ,|< | .|> | /^? | :RSHFT |
`---------+--------+--------+--------+--------+--------' `--------+--------+--------+--------+--------+---------'
|WINDOW* | OSMeh | *** | _|- | | Up | Down | Left | Right |
|WINDOW* | OSMeh | Fn | _|- | | Up | Down | Left | Right |
`-----------------------------------' `-----------------------------------'
,-----------------. ,-----------------.
|SELWORD |CAPSWORD| | NUMWORD| ( / NAV|
@ -155,6 +154,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* Manually exit CAPS word by pressing any modifier or holding a Modtap to the mod activation point
* Window Tap Dance is configured for Rectangle Pro
* SWAPHD swap the hands of the keycode matrix, except the top small key row is left as is
* PROGRAM puts board into program mode, using both control keys + b
Tap Dance Details:
* WINDOW 1: One shot NAV layer with CTL+OPT active
@ -222,12 +222,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_QWERTY] = LAYOUT_pretty(
ESC_STS, SH_TT, KC_F2, TO(_QWERTY), TG(_NUMSHIFT),TG(_FUNCTION),TG(_KEYPAD),TG(_NAV), TG(_VIM), CLEAR, DM_PLY1, DM_REC1, DM_RSTP,KC_MUTE,KC_VOLD,KC_VOLU,TG(_KEYPAD), KC_APFN,
ESC_STS, SH_TT, KC_F2, TO(_QWERTY), TG(_NUMSHIFT),TG(_FUNCTION),TG(_KEYPAD),TG(_NAV), TG(_VIM), CLEAR, DM_PLY1, DM_REC1, DM_RSTP,KC_MUTE,KC_VOLD,KC_VOLU,TG(_KEYPAD), KC_SCRL,
TD(GVES), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, TG(_NAV),
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, TD(ISPT),KC_O, KC_P, HYPR_T(KC_BSPC),
KC_TAB, LT(0,KC_Q), LT(0,KC_W), KC_E, KC_R, KC_T, KC_Y, KC_U, TD(ISPT),KC_O, KC_P, HYPR_T(KC_BSPC),
TD(LPINKY),LCTL_T(KC_A),LOPT_T(KC_S),LGUI_T(KC_D),LSFT_T(KC_F),KC_G, KC_H,RSFT_T(KC_J),RGUI_T(KC_K),ROPT_T(KC_L),TD(COLON),TD(RPINKY),
OSM(MOD_LSFT),LT(0,KC_Z),LT(0,KC_X),LT(0,KC_C),LT(0,KC_V),KC_B, KC_N, KC_M, TD(CMAG),TD(PDAG),TD(SLSH), OSM(MOD_RSFT),
TD(WIND), OSM(MOD_MEH), _______,TD(UNMN), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
TD(WIND), OSM(MOD_MEH), KC_APFN,TD(UNMN), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
SELWORD, CAPWORD, NUMWORD, LT(_NAV, KC_LPRN),
TD(SPOT), TD(WIND),
LGUI_T(KC_BSPC), SFT_T(KC_DEL), APP_NAV, OSM(MOD_MEH), LT(_KEYPAD, KC_ENT), RGUI_T(KC_SPC)
@ -244,7 +244,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
| | | | | | | | | | | | | | | | | | | |
`--------------------------------------------------------------' `--------------------------------------------------------------'
,------------------------------------------------------. ,------------------------------------------------------.
| | | | | | | | | | | | | |
| | Teensy | | | | | | | | | | | |
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
| | QMK Web| |Terminal| Chrome |Todoist | |SystPref|QuikNote|KrbnrEvt|Spotify |Photoshp| |
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
@ -331,6 +331,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
| | | / | | | | |
`--------------------------' `--------------------------'
TODO:
* consider adding < > %
* consider moving brackets again
*/
[_SYMBOLS] = LAYOUT_pretty(
@ -359,7 +362,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
| | | | | | | | | | | | | |
`---------+--------+--------+--------+--------+--------' `--------+--------+--------+--------+--------+---------'
| | | | | | | | | |
| | | LEFT | RIGHT | | UP | DOWN | | |
`-----------------------------------' `-----------------------------------'
,-----------------. ,-----------------.
| | | | | |
@ -376,7 +379,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, KC_LEFT, KC_RGHT, KC_UP, KC_DOWN, _______, _______,
_______, _______, _______, _______,
_______, _______,
_______, _______, _______, _______, _______, _______
@ -997,12 +1000,12 @@ void colon_td_finished (qk_tap_dance_state_t *state, void *user_data) {
// qk_tap_dance_full_t *keycodes = (qk_tap_dance_full_t *)user_data;
colon_td_state.state = hold_cur_dance(state);
switch (colon_td_state.state) {
case SINGLE_TAP: layer_on(_SYMBOLS); set_oneshot_layer(_SYMBOLS, ONESHOT_START); break; // One shot coding symbols layer
case SINGLE_TAP: set_oneshot_layer(_SYMBOLS, ONESHOT_START); break; // One shot coding symbols layer
case SINGLE_HOLD: set_mods(MOD_BIT(KC_RCTL)); break; // Mod tap RCTRL
case DOUBLE_TAP: tap_code16(KC_COLN); break; // Colon
case DOUBLE_HOLD: caps_word_set(true); break; // Caps Word
// case DOUBLE_TAP: tap_code16(KC_COLN); break; // Colon
case DOUBLE_HOLD: layer_on(_NAV); break; // Caps Word
// case TRIPLE_TAP: layer_invert(_KEYPAD); break; // Toggle KEYPAD layer
case TRIPLE_HOLD: led_wave(true); break; //
// case TRIPLE_HOLD: led_wave(true); break; //
default: break;
}
}
@ -1013,9 +1016,9 @@ void colon_td_reset (qk_tap_dance_state_t *state, void *user_data) {
case SINGLE_TAP: clear_oneshot_layer_state(ONESHOT_PRESSED); break;
case SINGLE_HOLD: unregister_mods(MOD_BIT(KC_RCTL)); break;
// case DOUBLE_TAP: unregister_code16(G(KC_GRV)); break;
// case DOUBLE_HOLD: layer_off(_NAV); clear_mods(); break;
case DOUBLE_HOLD: layer_off(_NAV); break;
// case TRIPLE_TAP: layer_invert(_NUMPAD); break;
case TRIPLE_HOLD: led_wave(false); break;
// case TRIPLE_HOLD: led_wave(false); break;
default: break;
}
colon_td_state.state = 0;
@ -1153,6 +1156,30 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[WIND] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, window_td_finished, window_td_reset),
};
bool caps_word_press_user(uint16_t keycode) {
switch (keycode) {
// Keycodes that continue Caps Word, with shift applied.
case KC_A ... KC_Z:
case TD(ISPT):
add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to the next key.
print("\nkeycodes that continue CW WITH shifting");
return true;
// Keycodes that continue Caps Word, without shifting.
case KC_1 ... KC_0:
case KC_BSPC:
case KC_MINS:
case KC_UNDS:
print("\nkeycodes that continue CW without shifting");
return true;
default:
return false; // Deactivate Caps Word.
}
}
// This function holds the main switch statement for keycode definitions
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
@ -1175,49 +1202,101 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
}
return true; // Return true for normal processing of tap key code
case LT(0,KC_C):
if (!record->tap.count && record->event.pressed) {
tap_code16(G(KC_C)); // Intercept hold function to send CMD+C
return false;
}
return true; // Return true for normal processing of tap keycode
case LT(0,KC_V):
if (!record->tap.count && record->event.pressed) {
tap_code16(G(KC_V)); // Intercept hold function to send CMD+V
return false;
}
return true; // Return true for normal processing of tap keycode
case LT(0,KC_Z):
if (!record->tap.count && record->event.pressed) {
tap_code16(G(KC_Z)); // Intercept hold function to send CMD+Z
return false;
}
return true; // Return true for normal processing of tap keycode
case CLEAR: // Clears all keycodes currently pressed, including modifiers
case LT(0,KC_Y):
if (!record->tap.count && record->event.pressed) {
clear_keyboard();
tap_code16(SGUI(KC_Z)); // Intercept hold function to send CMD+SHIFT+Z for MacOS standard redo
return false;
}
return true; // Return true for normal processing of tap keycode
case RCTL_T(KC_COLN):
if (record->tap.count && record->event.pressed) {
// Detect the activation of either shift keys
if (mod_state & MOD_MASK_SHIFT || get_oneshot_mods() & MOD_MASK_SHIFT) {
// First temporarily canceling both shifts so that
// shift isn't applied to the KC_SCLN keycode
del_mods(MOD_MASK_SHIFT);
tap_code(KC_LNUM); // Dummy keypress to get rid of lingering one shot modifier shift that seems to be a bug
tap_code(KC_SCLN);
// Reapplying modifier state so that the held shift key(s)
// still work even after having tapped the colon key.
set_mods(mod_state);
}
else{
tap_code16(KC_COLN); // Send KC_COLN on single tap
}
return false; // Return false to ignore further processing of key
case LT(0,KC_Q):
if (!record->tap.count && record->event.pressed) {
tap_code16(SGUI(KC_Q)); // Intercept hold function to send CMD+Q
return false;
}
break;
return true; // Return true for normal processing of tap keycode
case LT(0,KC_W):
if (!record->tap.count && record->event.pressed) {
tap_code16(SGUI(KC_W)); // Intercept hold function to send CMD+W
return false;
}
return true; // Return true for normal processing of tap keycode
case KC_SCRL: // Shortcut for QMK compiling in terminal add command for all of that plus a shortcut to Teensy and activate program (flashing) mode
if (record->event.pressed) {
clear_mods();
tap_code16(MEH(KC_E));
SEND_STRING(SS_DELAY(500) "cd ~/code/github/qmk_firmware");
tap_code(KC_ENT);
SEND_STRING("qmk compile");
tap_code(KC_ENT);
SEND_STRING(SS_DELAY(2000));
}
if (record->event.pressed && (mod_state & MOD_MASK_GUI)) {
clear_mods();
SEND_STRING(SS_DELAY(300));
tap_code16(MEH(KC_1));
SEND_STRING(SS_DELAY(300));
set_mods(MOD_MASK_CTRL);
add_oneshot_mods(MOD_MASK_CTRL);
tap_code(KC_B);
// SEND_STRING(SS_DELAY(2000));
// clear_mods();
// tap_code16(LCAG(KC_2));
// SEND_STRING(SS_DELAY(2000));
// tap_code16(LCAG(KC_3));
return false;
}
return false; // Return true for normal processing of tap keycode
case CLEAR: // Clears all keycodes currently pressed, including modifiers
if (record->event.pressed) {
clear_keyboard();
return false;
}
return true; // Return true for normal processing of tap keycode
// case RCTL_T(_______):
// if (record->tap.count == 1 && record->event.pressed) {
// set_oneshot_layer(_SYMBOLS, ONESHOT_START);
// return false;
// } else if (record->tap.count == 2 && record->event.pressed) {
// layer_on(_NAV);
// return false;
// }
// else if (record->tap.count == 1) { // Key up event after single tap
// clear_oneshot_layer_state(ONESHOT_PRESSED);
// return false;
// }
// else if (record->tap.count == 2) { // Key up event after double tap
// layer_off(_NAV);
// return false;
// }
// else { return true; } // Return true for normal processing of tap keycode, as in case of normal modtap hold
case LGUI_T(KC_BSPC):
case HYPR_T(KC_BSPC):
{


+ 1
- 0
keyboards/kinesis/kint36/keymaps/kevkevco/my_keycodes.h View File

@ -26,4 +26,5 @@ enum my_keycodes {
KPSWAP,
CAPWORD,
NUMWORD,
PROGRAM,
};

+ 8
- 174
keyboards/kinesis/kint36/keymaps/kevkevco/readme.md View File

@ -3,7 +3,12 @@
Tested with a Kinesis Advantage2, kinT (stapelberg) keyboard controller built
with a Teensy 3.6 microcontroller and a USA system layout.
# FN patch
Doesn't work using bt500 Bluetooth adapter.
## CAPSWORD and NUMWORD from replicaJunction
/Users/kevin/Code/Github/qmk_firmware/users/drashna/keyrecords
The concept here is simple: more often than you'd think, you need to type a single word in ALL CAPS. An easy example for me, as a programmer, is a constant value; in most programming languages, constants are typed in all caps by convention.
You typically have a few choices, but each one comes with a drawback. Here are the options I'm aware of:
@ -22,7 +27,6 @@ NUMWORD is a similar concept, but has a slightly more elaborate implementation.
**Note:** The implementation of NUMWORD requires that the keyboard's layer definitions be accessible in a header file. In my case, since I use a fairly standard set of layers, I've declared it in my userspace.
# Credits
numword from replicaJunction
@ -30,7 +34,7 @@ numword from replicaJunction
[bpruitt-goddard](https://github.com/qmk/qmk_firmware/blob/master/keyboards/ergodox_ez/keymaps/bpruitt-goddard/readme.md)
* Dynamic macro tap-dance
# TODO
// Inactive Aliases
// #define NUMPAD TG(_NUMPAD)
@ -62,9 +66,6 @@ numword from replicaJunction
// #define TD_PSPA TD(PSPA)
// #define NKROTG MAGIC_TOGGLE_NKRO
case PRG_EQ: {
if (record->event.pressed) {
SEND_STRING("==");
@ -83,9 +84,7 @@ numword from replicaJunction
SEND_STRING("qmk compile --keyboard " QMK_KEYBOARD " --keymap " QMK_KEYMAP);
return false;
}
<!--
# Blank Keymap Templates
ACTIVE
@ -127,7 +126,7 @@ ACTIVE
# Swap Hands
// Swapping Hands Matrix starting on line numbers that end in 0 for quick counting
@ -159,168 +158,3 @@ ACTIVE
{ kD0, kD1, kD2, kD3, kD4, kD5, ___ }, \
{ kE0, kE1, kE2, kE3, kE4, kE5, ___ } \
}
INACTIVE
/*
Blank layer:
,-------------------------------------------------------------------------------.
| | | | | | | | | |
`-------------------------------------------------------------------------------'
,-------------------------------------------------------------------------------.
| | | | | | | | | |
`-------------------------------------------------------------------------------'
,-------------------------------------------.,-------------------------------------------.
| | | | | | || | | | | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | | | | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | | | | | |
|--------+------+------+------+------+------||------+------+------+------+------+--------|
| | | | | | || | | | | | |
`--------+------+------+------+------+------'`------+------+------+------+------+--------'
| | | | | | | | | |
`---------------------------' `---------------------------'
,-------------.,-------------.
| | || | |
,------|------|------||------+------+------.
| | | || | | |
| | |------||------| | |
| | | || | | |
`--------------------'`--------------------'
*/
/*
[_BLANK] = LAYOUT_pretty (
// Left Hand
_______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______,
// Left Thumb
_______, _______,
_______,
_______, _______, _______,
// Right Hand
_______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______,
_______, _______, _______, _______,
// Right Thumb
_______, _______,
_______,
_______, _______, _______
),
*/
/*
Compressed pretty layout
,--------------------------------------------------------------. ,--------------------------------------------------------------.
| | | | | | | | | | | | | | | | | | | |
`--------------------------------------------------------------' `--------------------------------------------------------------'
,------------------------------------------------------. ,------------------------------------------------------.
| | | | | | | | | | | | | |
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
| | | | | | | | | | | | | |
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
| | | | | | | | | | | | | |
|---------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+---------|
| | | | | | | | | | | | | |
`---------+--------+--------+--------+--------+--------' `--------+--------+--------+--------+--------+---------'
| | | | | | | | | |
`-----------------------------------' `-----------------------------------'
,-----------------. ,-----------------.
| | | | | |
,--------+--------+--------| |--------+--------+--------.
| | | | | | | |
| | |--------| |--------| | |
| | | | | | | |
`--------------------------' `--------------------------'
*/
/* Archived Not Pretty Layout
[_QWERTY] = LAYOUT (
// Left Hand
ESC_STATUS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, TG(_FUNCTION), TG(_VIM),
QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T,
OSM(MOD_LGUI), LCTL_T(KC_A), LOPT_T(KC_S), LGUI_T(KC_D), LSFT_T(KC_F), KC_G,
OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B,
TD(PLEQ), TD(MNUN), KC_LEFT, KC_RGHT,
LCTL_T(KC_ESC), KC_LAPO,
G(KC_SPC),
KC_BSPC, LGUI_T(KC_DEL), APP_NAV,
// Right Hand
QWERTY, KC_F10, KC_F11, TG(_SYMBOLS), KC_MUTE, KC_VOLD, KC_VOLU, TG(_KEYPAD), TG(_PROGRAM),
KC_6, KC_7, KC_8, KC_9, KC_0, TG(_NAV),
KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_H, RSFT_T(KC_J), RGUI_T(KC_K), ROPT_T(KC_L), RCTL_T(KC_SCLN), TD(APQU),
KC_N, KC_M, TD(CMAG), TD(PDAG), KC_SLSH, OSM(MOD_RSFT),
KC_UP, KC_DOWN, TD(LBCB), TD(RBCB),
KC_RCPC, KC_LEAD,
HYPR_T(KC_BSPC),
OSM(MOD_MEH), LT(_KEYPAD, KC_ENT), RGUI_T(KC_SPC)
),
*/
// Triple Tap Tap Dance Function Definition
// void triple_tap_dance_pair_on_each_tap(qk_tap_dance_state_t *state, void *user_data) {
// qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
// if (state->count == 3) {
// // immediately finish on third press
// register_code16(pair->kc2);
// state->finished = true;
// }
// }
// void triple_tap_dance_pair_finished(qk_tap_dance_state_t *state, void *user_data) {
// qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
// if (state->count == 1) {
// register_code16(pair->kc1);
// } else if (state->count == 2) {
// // tap plus hold
// tap_code16(pair->kc1);
// register_code16(pair->kc1);
// } else if (state->count == 3) {
// register_code16(pair->kc2);
// }
// }
// void triple_tap_dance_pair_reset(qk_tap_dance_state_t *state, void *user_data) {
// qk_tap_dance_pair_t *pair = (qk_tap_dance_pair_t *)user_data;
// if (state->count == 1 || state->count == 2) {
// // 1-tap and 2-tap both result in `kc1` pressed so release it
// unregister_code16(pair->kc1);
// } else if (state->count == 3) {
// unregister_code16(pair->kc2);
// }
// // }
// #define TRIPLE_TAP_DANCE_DOUBLE(kc1, kc2) \
// { .fn = {
// triple_tap_dance_pair_on_each_tap, triple_tap_dance_pair_finished, triple_tap_dance_pair_reset
// },
// .user_data = (void *) & ( (qk_tap_dance_pair_t) {kc1, kc2} ),
// }
// END Triple Tap Tap Dance Function Definition

+ 4
- 1
keyboards/kinesis/kint36/keymaps/kevkevco/rules.mk View File

@ -19,4 +19,7 @@ SRC += features/caps_word.c # Add caps_word files
SRC += features/select_word.c
# Enable numword
SRC += features/num_word.c
SRC += features/num_word.c
# Debugging
CONSOLE_ENABLE = yes

Loading…
Cancel
Save