Skip to content

Commit

Permalink
keycodes
Browse files Browse the repository at this point in the history
  • Loading branch information
kissetfall committed Feb 6, 2023
1 parent d21b1b2 commit c10cb48
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 8 deletions.
46 changes: 46 additions & 0 deletions keyboards/ergohaven/k02/keymaps/j/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ char wpm_str[4];
#define APP_C LSG(KC_C)
#define APP_V LSG(KC_V)

enum custom_keycodes {
NEXTSEN = USER00,
PREDL,
BRACES,
PARENTH
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_all(
Expand Down Expand Up @@ -324,3 +330,43 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
}
};

bool process_record_user(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case NEXTSEN: // Next sentence macro.
if (record->event.pressed) {
SEND_STRING(". ");
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
}
return false;

case PREDL: // Next sentence macro.
if (record->event.pressed) {
SEND_STRING("/ ");
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
}
return false;

case BRACES:
if (record->event.pressed) {
uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
if (shifted) {
unregister_code(KC_LSFT);
unregister_code(KC_RSFT);
SEND_STRING("{}"SS_TAP(X_LEFT));
}
else {
SEND_STRING("[]"SS_TAP(X_LEFT));
}
}
break;

case PARENTH:
if (record->event.pressed) {
SEND_STRING("()");
tap_code(KC_LEFT);
}
break;
}
}

24 changes: 17 additions & 7 deletions keyboards/ergohaven/k02/keymaps/j/vial.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@
"cols": 6
},
"customKeycodes": [
{"name": "RU_A",
"title": "A (Cyrillic)",
"shortName": "RU_A"
{"name": "NEXTSEN",
"title": "Add a dot then capitalize the first letter of a new sentence (US layout)",
"shortName": "NEXTSEN"
},
{"name": "Linux Unicode",
"title": "NICE",
"shortName": "UNIC_LIN"
}
{"name": "PREDL",
"title": "Поставить точку и начать новое предложение с заглавной буквы (Русская раскладка)",
"shortName": "PREDL"
},
{"name": "BRACES",
"title": "This keycode types [, then ], and taps the left arrow to position the cursor between the []. Or if shift is held, it does the same but with curly braces {}.",
"shortName": "BRACES"
},
{"name": "PARENTH",
"title": "This keycode types (, then ), and taps the left arrow to position the cursor between the ().",
"shortName": "PARENTH"
}


],
"layouts": {
"keymap":[
Expand Down
48 changes: 47 additions & 1 deletion keyboards/ergohaven/k02/keymaps/vial/keymap.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include QMK_KEYBOARD_H

#include <stdio.h>
char wpm_str[4];

Expand Down Expand Up @@ -28,6 +27,13 @@ char wpm_str[4];
#define PREVWRD LCTL(KC_LEFT)
#define NEXTWRD LCTL(KC_RIGHT)

enum custom_keycodes {
NEXTSEN = USER00,
PREDL,
BRACES,
PARENTH
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_all( \
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \
Expand Down Expand Up @@ -318,3 +324,43 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
}



bool process_record_user(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case NEXTSEN: // Next sentence macro.
if (record->event.pressed) {
SEND_STRING(". ");
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
}
return false;

case PREDL: // Next sentence macro.
if (record->event.pressed) {
SEND_STRING("/ ");
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
}
return false;

case BRACES:
if (record->event.pressed) {
uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
if (shifted) {
unregister_code(KC_LSFT);
unregister_code(KC_RSFT);
SEND_STRING("{}"SS_TAP(X_LEFT));
}
else {
SEND_STRING("[]"SS_TAP(X_LEFT));
}
}
break;

case PARENTH:
if (record->event.pressed) {
SEND_STRING("()");
tap_code(KC_LEFT);
}
break;
}
}
18 changes: 18 additions & 0 deletions keyboards/ergohaven/k02/keymaps/vial/vial.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
"rows": 10,
"cols": 6
},
"customKeycodes": [
{"name": "NEXTSEN",
"title": "Add a dot then capitalize the first letter of a new sentence (US layout)",
"shortName": "NEXTSEN"
},
{"name": "PREDL",
"title": "Поставить точку и начать новое предложение с заглавной буквы (Русская раскладка)",
"shortName": "PREDL"
},
{"name": "BRACES",
"title": "This keycode types [, then ], and taps the left arrow to position the cursor between the []. Or if shift is held, it does the same but with curly braces {}.",
"shortName": "BRACES"
},
{"name": "PARENTH",
"title": "This keycode types (, then ), and taps the left arrow to position the cursor between the ().",
"shortName": "PARENTH"
}
],
"layouts": {
"keymap":[
[{"c":"#aaaaaa","x":3},"0,3",{"x":7.25},"5,2"],
Expand Down
44 changes: 44 additions & 0 deletions keyboards/ergohaven/remnant/keymaps/vial/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
#define PREVWRD LCTL(KC_LEFT)
#define NEXTWRD LCTL(KC_RIGHT)

enum custom_keycodes {
NEXTSEN = USER00,
PREDL,
BRACES,
PARENTH
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_5x6(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
Expand Down Expand Up @@ -91,4 +98,41 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
}
}

bool process_record_user(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case NEXTSEN: // Next sentence macro.
if (record->event.pressed) {
SEND_STRING(". ");
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
}
return false;

case PREDL: // Next sentence macro.
if (record->event.pressed) {
SEND_STRING("/ ");
add_oneshot_mods(MOD_BIT(KC_LSFT)); // Set one-shot mod for shift.
}
return false;

case BRACES:
if (record->event.pressed) {
uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
if (shifted) {
unregister_code(KC_LSFT);
unregister_code(KC_RSFT);
SEND_STRING("{}"SS_TAP(X_LEFT));
}
else {
SEND_STRING("[]"SS_TAP(X_LEFT));
}
}
break;

case PARENTH:
if (record->event.pressed) {
SEND_STRING("()");
tap_code(KC_LEFT);
}
break;
}
}
18 changes: 18 additions & 0 deletions keyboards/ergohaven/remnant/keymaps/vial/vial.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
"rows": 12,
"cols": 6
},
"customKeycodes": [
{"name": "NEXTSEN",
"title": "Add a dot then capitalize the first letter of a new sentence (US layout)",
"shortName": "NEXTSEN"
},
{"name": "PREDL",
"title": "Поставить точку и начать новое предложение с заглавной буквы (Русская раскладка)",
"shortName": "PREDL"
},
{"name": "BRACES",
"title": "This keycode types [, then ], and taps the left arrow to position the cursor between the []. Or if shift is held, it does the same but with curly braces {}.",
"shortName": "BRACES"
},
{"name": "PARENTH",
"title": "This keycode types (, then ), and taps the left arrow to position the cursor between the ().",
"shortName": "PARENTH"
}
],
"layouts": {
"keymap":
[
Expand Down

0 comments on commit c10cb48

Please sign in to comment.