update keychron q4
This commit is contained in:
parent
0ad20bbee8
commit
6f753a482f
|
@ -3,9 +3,6 @@
|
|||
// Layers
|
||||
#define SPACEFN LT(_SPACEFN, KC_SPC)
|
||||
|
||||
// Shortcuts
|
||||
#define DELWORD LCTL(KC_W)
|
||||
|
||||
// One Shot Keys
|
||||
#define OS_LCTL OSM(MOD_LCTL)
|
||||
#define OS_LSFT OSM(MOD_LSFT)
|
||||
|
|
|
@ -33,11 +33,16 @@ enum layers {
|
|||
enum custom_keycodes {
|
||||
VI_SAVE = SAFE_RANGE,
|
||||
VI_EXIT,
|
||||
DC_MUTE,
|
||||
DC_DFEN,
|
||||
DELWORD,
|
||||
UPDIR,
|
||||
};
|
||||
|
||||
/* Define our combo keycodes */
|
||||
enum combos {
|
||||
NE_ESCAPE,
|
||||
REPEAT_SPACE,
|
||||
COMBO_LENGTH
|
||||
};
|
||||
|
||||
|
@ -46,10 +51,12 @@ uint16_t COMBO_LEN = COMBO_LENGTH;
|
|||
|
||||
// Define key sequences
|
||||
const uint16_t PROGMEM ne_combo[] = {HOME_N, HOME_E, COMBO_END};
|
||||
const uint16_t PROGMEM repeat_space_combo[] = {OS_LALT, SPACEFN, COMBO_END};
|
||||
|
||||
// List the combination of keys and there resulting action
|
||||
combo_t key_combos[] = {
|
||||
[NE_ESCAPE] = COMBO(ne_combo, KC_ESC),
|
||||
[REPEAT_SPACE] = COMBO_ACTION(repeat_space_combo),
|
||||
};
|
||||
|
||||
/* Define our keymaps */
|
||||
|
@ -104,14 +111,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
|
||||
KC_TAB, KC_W, KC_L, KC_Y, KC_P, KC_K, KC_Z, KC_X, KC_O, KC_U, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||
CW_TOGG, HOME_C, HOME_R, HOME_S, HOME_T, KC_B, KC_F, HOME_N, HOME_E, HOME_I, HOME_A, KC_QUOT, KC_ENT,
|
||||
OS_LSFT, KC_J, KC_V, KC_D, KC_G, KC_Q, KC_M, KC_H, KC_SLSH, KC_COMM, KC_DOT, KC_RSFT,
|
||||
OS_LSFT, KC_J, KC_V, KC_D, KC_G, KC_Q, KC_M, KC_H, KC_SLSH, KC_COMM, KC_DOT, OS_RSFT,
|
||||
OS_LCTL, OS_LGUI, OS_LALT, SPACEFN, OS_RALT, MO(_FN1), MO(_FN2), OS_RCTL),
|
||||
|
||||
/**
|
||||
* SPACEFN
|
||||
*
|
||||
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
|
||||
* │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│DELWORD│
|
||||
* │../│F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│DELWORD│
|
||||
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
|
||||
* │ │:w │:q!│PUP│PDN│ │ │HOM│END│ │ │ │ │ │
|
||||
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
|
||||
|
@ -126,7 +133,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*
|
||||
*/
|
||||
[_SPACEFN] = LAYOUT_ansi_61(
|
||||
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DELWORD,
|
||||
UPDIR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DELWORD,
|
||||
XXXXXXX, VI_SAVE, VI_EXIT, KC_PGUP, KC_PGDN, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, KC_LGUI, KC_LALT, KC_LSFT, KC_LCTL, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, XXXXXXX, KC_INS,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_DEL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
@ -136,11 +143,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* Function 1
|
||||
*
|
||||
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
|
||||
* │ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│DELETE │
|
||||
* │ │MUT│DFN│VUP│VDN│HOM│BAK│FWD│REF│PLY│STP│PRV│NXT│ SLEEP │
|
||||
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
|
||||
* │ │ │UP │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
|
||||
* │ │LFT│DWN│RGT│ │ │ │ │ │ │ │ │ │
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤
|
||||
|
@ -149,9 +156,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*
|
||||
*/
|
||||
[_FN1] = LAYOUT_ansi_61(
|
||||
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
|
||||
XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, DC_MUTE, DC_DFEN, KC_VOLU, KC_VOLD, KC_WHOM, KC_WBAK, KC_WFWD, KC_WREF, KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, KC_SLEP,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX),
|
||||
|
||||
|
@ -159,7 +166,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* Function 2
|
||||
*
|
||||
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │BOOTLDR│
|
||||
* │ │X01│X02│X03│X04│X05│X06│X07│X08│X09│X10│X11│X12│BOOTLDR│
|
||||
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤
|
||||
* │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
|
||||
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
|
||||
|
@ -172,7 +179,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*
|
||||
*/
|
||||
[_FN2] = LAYOUT_ansi_61(
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT,
|
||||
XXXXXXX, PB_1, PB_2, PB_3, PB_4, PB_5, PB_6, PB_7, PB_8, PB_9, PB_10, PB_11, PB_12, QK_BOOT,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
|
||||
|
@ -196,7 +203,38 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
tap_code(KC_ENT);
|
||||
}
|
||||
break;
|
||||
case DC_MUTE:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL(SS_LSFT("m")));
|
||||
}
|
||||
break;
|
||||
case DC_DFEN:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL(SS_LSFT("d")));
|
||||
}
|
||||
break;
|
||||
case DELWORD:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL("w"));
|
||||
}
|
||||
break;
|
||||
case UPDIR:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("cd ../");
|
||||
tap_code(KC_ENT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/* Define the behaviour of our custom combos */
|
||||
void process_combo_event(uint16_t combo_index, bool pressed) {
|
||||
switch(combo_index) {
|
||||
case REPEAT_SPACE:
|
||||
if (pressed) {
|
||||
register_code(KC_SPC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Squeezing the most out of AVR
|
||||
LTO_ENABLE = yes
|
||||
LTO_ENABLE = yes
|
||||
|
||||
# Enable some features
|
||||
CAPS_WORD_ENABLE = yes
|
||||
COMBO_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
COMBO_ENABLE = yes
|
||||
PROGRAMMABLE_BUTTON_ENABLE = yes
|
||||
|
||||
|
|
Loading…
Reference in a new issue