[Keymap] Jonavin keymap Mercutio add win key lockout function (#13670)
Co-authored-by: Jonavin <=>
This commit is contained in:
parent
dc2dfe2a6c
commit
8d611f6873
2 changed files with 51 additions and 17 deletions
|
@ -28,6 +28,7 @@ enum custom_layers {
|
||||||
|
|
||||||
enum custom_keycodes {
|
enum custom_keycodes {
|
||||||
ENCFUNC = SAFE_RANGE, // encoder function keys
|
ENCFUNC = SAFE_RANGE, // encoder function keys
|
||||||
|
KC_WINLCK, //Toggles Win key on and off
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tap Dance Definitions
|
// 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),
|
[TD_LSFT_CAPSLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool _isWinKeyDisabled = false;
|
||||||
|
|
||||||
#define KC_LSFTCAPS TD(TD_LSFT_CAPSLOCK)
|
#define KC_LSFTCAPS TD(TD_LSFT_CAPSLOCK)
|
||||||
#define KC_CAD LALT(LCTL(KC_DEL))
|
#define KC_CAD LALT(LCTL(KC_DEL))
|
||||||
#define KC_AF4 LALT(KC_F4)
|
#define KC_AF4 LALT(KC_F4)
|
||||||
|
@ -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_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_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_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(
|
[_LOWER] = LAYOUT_all(
|
||||||
KC_TRNS,
|
KC_TRNS,
|
||||||
|
@ -75,7 +78,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_BSPC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS )
|
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
|
Defaults never changes if no encoder present to change it
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -93,7 +96,8 @@ static const keycodedescType PROGMEM keyselection[] = {
|
||||||
{"Break", KC_PAUS},
|
{"Break", KC_PAUS},
|
||||||
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
|
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
|
||||||
{"AltF4", KC_AF4},
|
{"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])
|
#define MAX_KEYSELECTION sizeof(keyselection)/sizeof(keyselection[0])
|
||||||
|
@ -119,11 +123,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
switch (keycode) {
|
switch (keycode) {
|
||||||
case ENCFUNC:
|
case ENCFUNC:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
tap_code16(selectedkey_rec.keycode);
|
selectedkey_rec.keycode == RESET ? reset_keyboard() : tap_code16(selectedkey_rec.keycode); // handle RESET code
|
||||||
} else {
|
} else {
|
||||||
// when keycode is released
|
// when keycode is released
|
||||||
}
|
}
|
||||||
break;
|
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;
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -163,9 +177,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
default: // all other layers
|
default: // all other layers
|
||||||
if ( clockwise ) {
|
if ( clockwise ) {
|
||||||
if ( selected_layer < 3 && keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) { // If you are holding L shift, encoder changes layers
|
||||||
|
if(selected_layer < 3) {
|
||||||
selected_layer ++;
|
selected_layer ++;
|
||||||
layer_move(selected_layer);
|
layer_move(selected_layer);
|
||||||
|
}
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
|
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate next word
|
||||||
tap_code16(LCTL(KC_RGHT));
|
tap_code16(LCTL(KC_RGHT));
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media next track
|
} 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
|
tap_code(KC_VOLU); // Otherwise it just changes volume
|
||||||
}
|
}
|
||||||
} else if ( !clockwise ) {
|
} else if ( !clockwise ) {
|
||||||
if ( selected_layer > 0 && keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
|
if (keyboard_report->mods & MOD_BIT(KC_LSFT) ) {
|
||||||
|
if (selected_layer > 0) {
|
||||||
selected_layer --;
|
selected_layer --;
|
||||||
layer_move(selected_layer);
|
layer_move(selected_layer);
|
||||||
|
}
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
|
} else if (keyboard_report->mods & MOD_BIT(KC_LCTL)) { // if holding Left Ctrl, navigate previous word
|
||||||
tap_code16(LCTL(KC_LEFT));
|
tap_code16(LCTL(KC_LEFT));
|
||||||
} else if (keyboard_report->mods & MOD_BIT(KC_LALT)) { // if holding Left Alt, change media previous track
|
} 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:
|
default:
|
||||||
oled_write_P(PSTR("Layer ?"), false); // Should never display, here as a catchall
|
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);
|
oled_set_cursor(8,3);
|
||||||
if (get_highest_layer(layer_state) == selected_layer) {
|
if (get_highest_layer(layer_state) == selected_layer) {
|
||||||
oled_write_P(PSTR(" "), false);
|
oled_write_P(PSTR(" "), false);
|
||||||
|
|
|
@ -13,6 +13,7 @@ Features
|
||||||
- shutdown oled when powered down to prevent OLED from showing Mercutio all the time
|
- shutdown oled when powered down to prevent OLED from showing Mercutio all the time
|
||||||
- add WPM indicator when wpm is > 20 wpm
|
- add WPM indicator when wpm is > 20 wpm
|
||||||
- add double tap of Left Shift to toggle Caps Lock
|
- 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
|
- FN layer has encoder selectable key codes and displayed on OLED
|
||||||
|
|
||||||
|
@ -28,7 +29,8 @@ Features
|
||||||
{"Break", KC_PAUS},
|
{"Break", KC_PAUS},
|
||||||
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
|
{"C-A-D", KC_CAD}, // Ctrl-Alt-Del
|
||||||
{"AltF4", KC_AF4},
|
{"AltF4", KC_AF4},
|
||||||
{"PLAY", KC_MEDIA_PLAY_PAUSE}
|
{"PLAY", KC_MEDIA_PLAY_PAUSE},
|
||||||
|
{"RESET", RESET}, // firmware flash mode
|
||||||
};
|
};
|
||||||
|
|
||||||
- Additional encoder functionality
|
- Additional encoder functionality
|
||||||
|
@ -37,4 +39,17 @@ Features
|
||||||
|
|
||||||
|
|
||||||
Default Layers
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue