fmt: clang-format
This commit is contained in:
parent
3bfec02cd2
commit
aa206ced07
|
@ -1,4 +1,4 @@
|
|||
// Dictionary management
|
||||
// clang-format off
|
||||
|
||||
// name result chord keys
|
||||
COMB(NE_ESC, KC_ESC, RCTL_T(KC_N), RSFT_T(KC_E))
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
// By default, the firmware does not know which side is which; it needs some help to determine that.
|
||||
// By default, the firmware does not know which side is which; it needs some
|
||||
// help to determine that.
|
||||
#define MASTER_LEFT
|
||||
|
||||
// Alternate way in QMK to enter the embedded mass storage UF2 boot-loader of the RP2040.
|
||||
// Alternate way in QMK to enter the embedded mass storage UF2 boot-loader of
|
||||
// the RP2040.
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 200U
|
||||
|
||||
|
@ -13,10 +15,14 @@
|
|||
#define ENABLE_COMPILE_KEYCODE
|
||||
|
||||
// Tap-Hold configuration for home row mods.
|
||||
#define TAPPING_TERM 175 // time window in which you need to release the key in order to register a tap
|
||||
#define PERMISSIVE_HOLD // activates the modifier when another key is pressed and released while the mod-tap is held, regardless of the tapping term
|
||||
#define QUICK_TAP_TERM 0 // disable the auto-repeat feature entirely
|
||||
#define ACHORDION_STREAK // disables hold behaviors when in a typing streak
|
||||
#define TAPPING_TERM \
|
||||
175 // time window in which you need to release the key in order to register a
|
||||
// tap
|
||||
#define PERMISSIVE_HOLD // activates the modifier when another key is pressed
|
||||
// and released while the mod-tap is held, regardless of
|
||||
// the tapping term
|
||||
#define QUICK_TAP_TERM 0 // disable the auto-repeat feature entirely
|
||||
#define ACHORDION_STREAK // disables hold behaviors when in a typing streak
|
||||
|
||||
// Timeouts
|
||||
#define ONESHOT_TIMEOUT 3000
|
||||
|
@ -27,19 +33,19 @@
|
|||
|
||||
// RGB
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
#define RGBLIGHT_SLEEP
|
||||
#define RGBLIGHT_EFFECT_BREATHING
|
||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
#define RGBLIGHT_EFFECT_SNAKE
|
||||
#define RGBLIGHT_EFFECT_KNIGHT
|
||||
#define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
#define RGBLIGHT_EFFECT_RGB_TEST
|
||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
||||
#define RGBLIGHT_EFFECT_TWINKLE
|
||||
#define RGBLIGHT_LIMIT_VAL 120
|
||||
#define RGBLIGHT_HUE_STEP 10
|
||||
#define RGBLIGHT_SAT_STEP 17
|
||||
#define RGBLIGHT_VAL_STEP 17
|
||||
#define RGBLIGHT_SLEEP
|
||||
#define RGBLIGHT_EFFECT_BREATHING
|
||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
#define RGBLIGHT_EFFECT_SNAKE
|
||||
#define RGBLIGHT_EFFECT_KNIGHT
|
||||
#define RGBLIGHT_EFFECT_CHRISTMAS
|
||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
#define RGBLIGHT_EFFECT_RGB_TEST
|
||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
||||
#define RGBLIGHT_EFFECT_TWINKLE
|
||||
#define RGBLIGHT_LIMIT_VAL 120
|
||||
#define RGBLIGHT_HUE_STEP 10
|
||||
#define RGBLIGHT_SAT_STEP 17
|
||||
#define RGBLIGHT_VAL_STEP 17
|
||||
#endif
|
||||
|
|
|
@ -17,22 +17,25 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
// Awesome features created by getreuer
|
||||
#include "features/sentence_case.h"
|
||||
#include "features/achordion.h"
|
||||
#include "features/select_word.h"
|
||||
#include "features/layer_lock.h"
|
||||
#include "features/select_word.h"
|
||||
#include "features/sentence_case.h"
|
||||
// https://github.com/getreuer/qmk-keymap/tree/main/features
|
||||
|
||||
// Our super useful layers, why we run qmk exclusively.
|
||||
enum layers {
|
||||
CANARY, // This layout is the result of collaboration between many of the top layout creators from the AKL community.
|
||||
NAV, // Inspired by the colemak communities extend layer, Brings navigation and editing to the home position.
|
||||
CANARY, // This layout is the result of collaboration between many of the top
|
||||
// layout creators from the AKL community.
|
||||
NAV, // Inspired by the colemak communities extend layer, Brings navigation
|
||||
// and editing to the home position.
|
||||
NUM, // Contains our numpad and function keys.
|
||||
SYM, // Contains our symbols.
|
||||
MOD, // Contains keyboard related modifications.
|
||||
};
|
||||
|
||||
// Combo dictionary management (layer names must be defined before engine include)
|
||||
// Combo dictionary management (layer names must be defined before engine
|
||||
// include)
|
||||
#include "g/keymap_combo.h"
|
||||
|
||||
// Our custom keycodes
|
||||
|
@ -53,8 +56,9 @@ enum custom_keycodes {
|
|||
MG_XES,
|
||||
};
|
||||
|
||||
// This keymap uses Magic Canary, it is inspired by Ikcelaks' Magic Sturdy layout.
|
||||
// The magic key is triggered with the fn combo. Currently only SFB and some common words are considered.
|
||||
// This keymap uses Magic Canary, it is inspired by Ikcelaks' Magic Sturdy
|
||||
// layout. The magic key is triggered with the fn combo. Currently only SFB and
|
||||
// some common words are considered.
|
||||
// https://github.com/Ikcelaks/keyboard_layouts
|
||||
|
||||
// This keymap uses home row mods. In addition to mods, I have home row
|
||||
|
@ -69,21 +73,21 @@ enum custom_keycodes {
|
|||
// +-------+ +-------+
|
||||
|
||||
// Left hand home row mods for CANARY layer.
|
||||
#define HRM_C LGUI_T(KC_C)
|
||||
#define HRM_R LALT_T(KC_R)
|
||||
#define HRM_S LSFT_T(KC_S)
|
||||
#define HRM_T LCTL_T(KC_T)
|
||||
#define HRM_C LGUI_T(KC_C)
|
||||
#define HRM_R LALT_T(KC_R)
|
||||
#define HRM_S LSFT_T(KC_S)
|
||||
#define HRM_T LCTL_T(KC_T)
|
||||
// Right hand home row mods for CANARY layer.
|
||||
#define HRM_N RCTL_T(KC_N)
|
||||
#define HRM_E RSFT_T(KC_E)
|
||||
#define HRM_I RALT_T(KC_I)
|
||||
#define HRM_A RGUI_T(KC_A)
|
||||
#define HRM_N RCTL_T(KC_N)
|
||||
#define HRM_E RSFT_T(KC_E)
|
||||
#define HRM_I RALT_T(KC_I)
|
||||
#define HRM_A RGUI_T(KC_A)
|
||||
// Bottom row mods for CANARY layer.
|
||||
#define HRM_D LT(SYM, KC_D)
|
||||
#define HRM_H LT(SYM, KC_H)
|
||||
#define HRM_D LT(SYM, KC_D)
|
||||
#define HRM_H LT(SYM, KC_H)
|
||||
|
||||
// Oneshot mods are available on our navigation layer.
|
||||
// This allows easy chords with typical window manager and terminal
|
||||
// This allows easy chords with typical window manager and terminal
|
||||
// bindings. Oneshot mods persist through layer changes.
|
||||
|
||||
// Left hand one shot keys.
|
||||
|
@ -105,16 +109,17 @@ enum custom_keycodes {
|
|||
#define BAK_NUM LT(NUM, KC_BSPC)
|
||||
|
||||
// Shortcuts
|
||||
#define CK_UNDO LCTL(KC_Z) // Undo
|
||||
#define CK_CUT LCTL(KC_X) // Cut
|
||||
#define CK_COPY LCTL(KC_C) // Copy
|
||||
#define CK_PSTE LCTL(KC_V) // Paste
|
||||
#define CK_UNDO LCTL(KC_Z) // Undo
|
||||
#define CK_CUT LCTL(KC_X) // Cut
|
||||
#define CK_COPY LCTL(KC_C) // Copy
|
||||
#define CK_PSTE LCTL(KC_V) // Paste
|
||||
|
||||
#define DELWORD LCTL(KC_BSPC) // Delete word
|
||||
#define WZ_CMOD LCTL(LSFT(KC_X)) // Wezterm activate copy mode.
|
||||
#define WZ_PSTE LCTL(LSFT(KC_V)) // Wezterm paste from clipboard.
|
||||
#define DELWORD LCTL(KC_BSPC) // Delete word
|
||||
#define WZ_CMOD LCTL(LSFT(KC_X)) // Wezterm activate copy mode.
|
||||
#define WZ_PSTE LCTL(LSFT(KC_V)) // Wezterm paste from clipboard.
|
||||
|
||||
// clang-format off
|
||||
|
||||
//Keymaps
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[CANARY] = LAYOUT_split_3x6_3(
|
||||
//,-----------------------------------------------------. ,-----------------------------------------------------.
|
||||
|
@ -176,136 +181,171 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
|
||||
// Bilateral combination exceptions
|
||||
bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t* tap_hold_record, uint16_t other_keycode, keyrecord_t* other_record) {
|
||||
bool achordion_chord(uint16_t tap_hold_keycode, keyrecord_t *tap_hold_record,
|
||||
uint16_t other_keycode, keyrecord_t *other_record) {
|
||||
switch (tap_hold_keycode) {
|
||||
// Excempt some mod/layer taps.
|
||||
case SPC_NAV:
|
||||
case ENT_SFT:
|
||||
case BAK_NUM:
|
||||
return true;
|
||||
break;
|
||||
// Excempt some mod/layer taps.
|
||||
case SPC_NAV:
|
||||
case ENT_SFT:
|
||||
case BAK_NUM:
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Otherwise follow opposite hands rule.
|
||||
return achordion_opposite_hands(tap_hold_record, other_record);
|
||||
}
|
||||
|
||||
bool remember_last_key_user(uint16_t keycode, keyrecord_t* record, uint8_t* remembered_mods) {
|
||||
bool remember_last_key_user(uint16_t keycode, keyrecord_t *record,
|
||||
uint8_t *remembered_mods) {
|
||||
// Forget Shift on letter keys when Shift or AltGr are the only mods.
|
||||
switch (keycode) {
|
||||
case KC_A ... KC_Z:
|
||||
if ((*remembered_mods & ~(MOD_MASK_SHIFT | MOD_BIT(KC_RALT))) == 0) {
|
||||
*remembered_mods &= ~MOD_MASK_SHIFT;
|
||||
}
|
||||
break;
|
||||
case KC_A ... KC_Z:
|
||||
if ((*remembered_mods & ~(MOD_MASK_SHIFT | MOD_BIT(KC_RALT))) == 0) {
|
||||
*remembered_mods &= ~MOD_MASK_SHIFT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16_t get_alt_repeat_key_keycode_user(uint16_t keycode, uint8_t mods) {
|
||||
switch (keycode) {
|
||||
// Minimize SFB on canary layout
|
||||
case HRM_R: return KC_L;
|
||||
case KC_V: return KC_Y;
|
||||
case HRM_S: return KC_Y;
|
||||
case KC_Y: return KC_S;
|
||||
case KC_P: return KC_T;
|
||||
case HRM_I: return KC_U;
|
||||
case KC_U: return KC_I;
|
||||
case KC_O: return KC_E;
|
||||
case HRM_E: return KC_O;
|
||||
// Remove problem scissors bigrams
|
||||
case KC_L: return KC_V;
|
||||
// Minimize SFB on canary layout
|
||||
case HRM_R:
|
||||
return KC_L;
|
||||
case KC_V:
|
||||
return KC_Y;
|
||||
case HRM_S:
|
||||
return KC_Y;
|
||||
case KC_Y:
|
||||
return KC_S;
|
||||
case KC_P:
|
||||
return KC_T;
|
||||
case HRM_I:
|
||||
return KC_U;
|
||||
case KC_U:
|
||||
return KC_I;
|
||||
case KC_O:
|
||||
return KC_E;
|
||||
case HRM_E:
|
||||
return KC_O;
|
||||
// Remove problem scissors bigrams
|
||||
case KC_L:
|
||||
return KC_V;
|
||||
|
||||
// Briefs
|
||||
case SPC_NAV: return MG_THE;
|
||||
case KC_COMM: return MG_BUT;
|
||||
case KC_B: return MG_BEFORE;
|
||||
case KC_J: return MG_JUST;
|
||||
case KC_M: return MG_MENT;
|
||||
case HRM_N: return MG_NION;
|
||||
case HRM_T: return MG_TMENT;
|
||||
case KC_W: return MG_WHICH;
|
||||
case KC_X: return MG_XES;
|
||||
// Briefs
|
||||
case SPC_NAV:
|
||||
return MG_THE;
|
||||
case KC_COMM:
|
||||
return MG_BUT;
|
||||
case KC_B:
|
||||
return MG_BEFORE;
|
||||
case KC_J:
|
||||
return MG_JUST;
|
||||
case KC_M:
|
||||
return MG_MENT;
|
||||
case HRM_N:
|
||||
return MG_NION;
|
||||
case HRM_T:
|
||||
return MG_TMENT;
|
||||
case KC_W:
|
||||
return MG_WHICH;
|
||||
case KC_X:
|
||||
return MG_XES;
|
||||
|
||||
// vim optimisations
|
||||
case HRM_C: return KC_W; // change word
|
||||
case HRM_D: return KC_W; // delete word
|
||||
// vim optimisations
|
||||
case HRM_C:
|
||||
return KC_W; // change word
|
||||
case HRM_D:
|
||||
return KC_W; // delete word
|
||||
}
|
||||
|
||||
return KC_TRNS;
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t* record) {
|
||||
if (!process_sentence_case(keycode, record)) { return false; }
|
||||
if (!process_achordion(keycode, record)) { return false; }
|
||||
if (!process_select_word(keycode, record, SELWORD)) { return false; }
|
||||
if (!process_layer_lock(keycode, record, LLOCK)) { return false; }
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
if (!process_sentence_case(keycode, record)) {
|
||||
return false;
|
||||
}
|
||||
if (!process_achordion(keycode, record)) {
|
||||
return false;
|
||||
}
|
||||
if (!process_select_word(keycode, record, SELWORD)) {
|
||||
return false;
|
||||
}
|
||||
if (!process_layer_lock(keycode, record, LLOCK)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (record->event.pressed) {
|
||||
int rep_count = get_repeat_key_count();
|
||||
// Define the behaviour of our custom keycodes.
|
||||
switch (keycode) {
|
||||
case SC_TOGG: // Toggle sentence case on/off.
|
||||
sentence_case_toggle();
|
||||
return false;
|
||||
// Magic key briefs
|
||||
case MG_THE:
|
||||
SEND_STRING(/* */"the");
|
||||
return false;
|
||||
case MG_BUT:
|
||||
SEND_STRING(/*,*/" but");
|
||||
return false;
|
||||
case MG_BEFORE:
|
||||
SEND_STRING(/*b*/"efore");
|
||||
return false;
|
||||
case MG_JUST:
|
||||
SEND_STRING(/*j*/"ust");
|
||||
return false;
|
||||
case MG_MENT:
|
||||
SEND_STRING(/*m*/"ent");
|
||||
return false;
|
||||
case MG_NION:
|
||||
SEND_STRING(/*n*/"ion");
|
||||
return false;
|
||||
case MG_TMENT:
|
||||
SEND_STRING(/*t*/"ment");
|
||||
return false;
|
||||
case MG_WHICH:
|
||||
SEND_STRING(/*w*/"hich");
|
||||
return false;
|
||||
case MG_XES:
|
||||
SEND_STRING(/*x*/"es");
|
||||
return false;
|
||||
case SC_TOGG: // Toggle sentence case on/off.
|
||||
sentence_case_toggle();
|
||||
return false;
|
||||
// Magic key briefs
|
||||
case MG_THE:
|
||||
SEND_STRING(/* */ "the");
|
||||
return false;
|
||||
case MG_BUT:
|
||||
SEND_STRING(/*,*/ " but");
|
||||
return false;
|
||||
case MG_BEFORE:
|
||||
SEND_STRING(/*b*/ "efore");
|
||||
return false;
|
||||
case MG_JUST:
|
||||
SEND_STRING(/*j*/ "ust");
|
||||
return false;
|
||||
case MG_MENT:
|
||||
SEND_STRING(/*m*/ "ent");
|
||||
return false;
|
||||
case MG_NION:
|
||||
SEND_STRING(/*n*/ "ion");
|
||||
return false;
|
||||
case MG_TMENT:
|
||||
SEND_STRING(/*t*/ "ment");
|
||||
return false;
|
||||
case MG_WHICH:
|
||||
SEND_STRING(/*w*/ "hich");
|
||||
return false;
|
||||
case MG_XES:
|
||||
SEND_STRING(/*x*/ "es");
|
||||
return false;
|
||||
}
|
||||
if (rep_count > 0) {
|
||||
// Repeat key overrides.
|
||||
switch (keycode) {
|
||||
// Minimize SFB on canary layout
|
||||
case HRM_N: SEND_STRING(/*n*/"f"); return false;
|
||||
// Briefs
|
||||
case SPC_NAV:
|
||||
SEND_STRING(/* */"for");
|
||||
return false;
|
||||
case KC_COMM:
|
||||
SEND_STRING(/*,*/" and");
|
||||
return false;
|
||||
case HRM_A:
|
||||
SEND_STRING(/*a*/"nd");
|
||||
return false;
|
||||
case HRM_I:
|
||||
SEND_STRING(/*i*/"ng");
|
||||
return false;
|
||||
case KC_Y:
|
||||
SEND_STRING(/*y*/"ou");
|
||||
return false;
|
||||
case KC_B:
|
||||
SEND_STRING(/*b*/"ecause");
|
||||
return false;
|
||||
case KC_W:
|
||||
SEND_STRING(/*w*/"ould");
|
||||
return false;
|
||||
// Minimize SFB on canary layout
|
||||
case HRM_N:
|
||||
SEND_STRING(/*n*/ "f");
|
||||
return false;
|
||||
// Briefs
|
||||
case SPC_NAV:
|
||||
SEND_STRING(/* */ "for");
|
||||
return false;
|
||||
case KC_COMM:
|
||||
SEND_STRING(/*,*/ " and");
|
||||
return false;
|
||||
case HRM_A:
|
||||
SEND_STRING(/*a*/ "nd");
|
||||
return false;
|
||||
case HRM_I:
|
||||
SEND_STRING(/*i*/ "ng");
|
||||
return false;
|
||||
case KC_Y:
|
||||
SEND_STRING(/*y*/ "ou");
|
||||
return false;
|
||||
case KC_B:
|
||||
SEND_STRING(/*b*/ "ecause");
|
||||
return false;
|
||||
case KC_W:
|
||||
SEND_STRING(/*w*/ "ould");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,9 +353,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
achordion_task();
|
||||
}
|
||||
void matrix_scan_user(void) { achordion_task(); }
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
// Declare screen rotation for each half
|
||||
|
@ -420,15 +458,16 @@ void oled_render_master(void) {
|
|||
oled_write(" wpm", false);
|
||||
}
|
||||
|
||||
|
||||
// Corne keyboard logo
|
||||
void oled_render_logo(void) {
|
||||
static const char PROGMEM crkbd_logo[] = {
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
|
||||
0};
|
||||
oled_write_P(crkbd_logo, false);
|
||||
static const char PROGMEM crkbd_logo[] = {
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
|
||||
0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0xa0,
|
||||
0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
|
||||
0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xc0, 0xc1,
|
||||
0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc,
|
||||
0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0};
|
||||
oled_write_P(crkbd_logo, false);
|
||||
}
|
||||
|
||||
// Render our screens
|
||||
|
|
Loading…
Reference in a new issue