summaryrefslogtreecommitdiff
path: root/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c')
-rwxr-xr-xkeyboards/mechwild/mercutio/keymaps/jonavin/keymap.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c b/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
index 6fadea4899..ed321e79b9 100755
--- a/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
+++ b/keyboards/mechwild/mercutio/keymaps/jonavin/keymap.c
@@ -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);