|
|
|
@ -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) |
|
|
|
@ -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, |
|
|
|
@ -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 ) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
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) ) { |
|
|
|
|
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); |
|
|
|
|