[Keymap] Jonavin keymap Mercutio add win key lockout function (#13670)

Co-authored-by: Jonavin <=>
master
Jonavin 2021-07-29 11:47:14 -04:00 committed by GitHub
parent dc2dfe2a6c
commit 8d611f6873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 17 deletions

View File

@ -28,6 +28,7 @@ enum custom_layers {
enum custom_keycodes {
ENCFUNC = SAFE_RANGE, // encoder function keys
KC_WINLCK, //Toggles Win key on and off
};
// Tap Dance Definitions
@ -40,6 +41,8 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[TD_LSFT_CAPSLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
};
bool _isWinKeyDisabled = false;
#define KC_LSFTCAPS TD(TD_LSFT_CAPSLOCK)
#define KC_CAD LALT(LCTL(KC_DEL))
#define KC_AF4 LALT(KC_F4)
@ -49,8 +52,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT_all(
KC_MUTE,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
TT(_RAISE), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFTCAPS, KC_SLSH, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SFTENT,
TT(_RAISE), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
KC_LSFTCAPS, KC_SLSH, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SFTENT,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, LT(_LOWER,KC_SPC), KC_SPC, KC_RALT, MO(_FN1), KC_RCTL ),
[_FN1] = LAYOUT_all(
@ -58,7 +61,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,
KC_CAPS, KC_F11, KC_F12, KC_NO, KC_NO, KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_NO,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NLCK, KC_NO, KC_NO, KC_NO, KC_SFTENT,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ),
KC_TRNS, KC_WINLCK, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ),
[_LOWER] = LAYOUT_all(
KC_TRNS,
@ -69,13 +72,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_RAISE] = LAYOUT_all(
KC_TRNS,
KC_TAB, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_PMNS, KC_PPLS, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,
KC_TAB, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_PMNS, KC_PPLS, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,
TT(_RAISE), KC_LEFT, KC_DOWN, KC_RIGHT,KC_PGDN, KC_PSLS, KC_TAB, KC_P4, KC_P5, KC_P6, KC_PDOT, KC_PEQL,
KC_TRNS, KC_TRNS, KC_NO, KC_DEL, KC_INS, KC_NO, KC_PAST, KC_P0, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_TRNS, KC_TRNS, KC_NO, KC_DEL, KC_INS, KC_NO, KC_PAST, KC_P0, KC_P1, KC_P2, KC_P3, KC_PENT,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS )
};
/* These are needed whether encoder function is enabled or not when ENCFUNC keycode is pressed.
/* These are needed whether encoder function is enabled or not when ENCFUNC keycode is pressed.?
Defaults never changes if no encoder present to change it
*/
typedef struct {
@ -93,7 +96,8 @@ static const keycodedescType PROGMEM keyselection[] = {
{"Break", KC_PAUS},
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
{"AltF4", KC_AF4},
{"PLAY", KC_MEDIA_PLAY_PAUSE}
{"PLAY", KC_MEDIA_PLAY_PAUSE},
{"RESET", RESET}, // firmware flash mode
};
#define MAX_KEYSELECTION sizeof(keyselection)/sizeof(keyselection[0])
@ -119,11 +123,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case ENCFUNC:
if (record->event.pressed) {
tap_code16(selectedkey_rec.keycode);
selectedkey_rec.keycode == RESET ? reset_keyboard() : tap_code16(selectedkey_rec.keycode); // handle RESET code
} else {
// when keycode is released
}
break;
case KC_WINLCK:
if (record->event.pressed) {
_isWinKeyDisabled = !_isWinKeyDisabled; //toggle status
if(_isWinKeyDisabled) {
process_magic(GUI_OFF, record);
} else {
process_magic(GUI_ON, record);
}
} else unregister_code16(keycode);
break;
}
return true;
};
@ -163,9 +177,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
default: // all other layers
if ( clockwise ) {
if ( selected_layer < 3 && keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
selected_layer ++;
layer_move(selected_layer);
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
if(selected_layer < 3) {
selected_layer ++;
layer_move(selected_layer);
}
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
tap_code16(LCTL(KC_RGHT));
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next track
@ -174,9 +190,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
tap_code(KC_VOLU); // Otherwise it just changes volume
}
} else if ( !clockwise ) {
if ( selected_layer > 0 && keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
selected_layer --;
layer_move(selected_layer);
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
if (selected_layer > 0) {
selected_layer --;
layer_move(selected_layer);
}
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
tap_code16(LCTL(KC_LEFT));
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media previous track
@ -256,6 +274,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
default:
oled_write_P(PSTR("Layer ?"), false); // Should never display, here as a catchall
}
oled_write_P(_isWinKeyDisabled ? PSTR(" WL") : PSTR(" "), false);
oled_set_cursor(8,3);
if (get_highest_layer(layer_state) == selected_layer) {
oled_write_P(PSTR(" "), false);

View File

@ -13,6 +13,7 @@ Features
- shutdown oled when powered down to prevent OLED from showing Mercutio all the time
- add WPM indicator when wpm is > 20 wpm
- add double tap of Left Shift to toggle Caps Lock
- add WinLock feature with FN + Win; display WL on OLED when enabled
- FN layer has encoder selectable key codes and displayed on OLED
@ -28,8 +29,9 @@ Features
{"Break", KC_PAUS},
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
{"AltF4", KC_AF4},
{"PLAY", KC_MEDIA_PLAY_PAUSE}
};
{"PLAY", KC_MEDIA_PLAY_PAUSE},
{"RESET", RESET}, // firmware flash mode
};
- Additional encoder functionality
While holding Left Ctrl, navigates next or previous word
@ -37,4 +39,17 @@ Features
Default Layers
![image](https://user-images.githubusercontent.com/71780717/118902752-4aaf7880-b8e4-11eb-82f4-e5047612ffcf.png)
![image](https://user-images.githubusercontent.com/71780717/127014682-3aa05136-6dc7-4a40-9be1-89a5b584848a.png)
MO(1) / FN Layer
![image](https://user-images.githubusercontent.com/71780717/127014620-a3a36dc6-6e22-4a9b-ad9a-6c6a5d18cbc5.png)
MO(2) / Lower layer
![image](https://user-images.githubusercontent.com/71780717/127014816-09598d62-2d23-42e5-a625-504a79a54ca9.png)
MO(3) / Raise layer
![image](https://user-images.githubusercontent.com/71780717/127014881-a181c198-a7e8-4f48-9789-a7a85eabcbd1.png)