1
0
Fork 0

Add language-switch for locking switch

This commit is contained in:
Balz Guenat 2017-08-04 04:16:39 +02:00
parent d8c503f3ac
commit 308bec28bb

View file

@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
| Fn1 | A | S | D | F | G | H | J | K | L | ; | ' | Enter | | Fn1 | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
| Shift | Z | X | C | V | B | N | M | , | . | / | Shift | | Shift | Z | X | C | V | B | N | M | , | . | / | Shift |M(0) |
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
| Ctrl | GUI | Alt | Space | Fn1 | Space | Alt | GUI | App | Ctrl | | Ctrl | GUI | Alt | Space | Fn1 | Space | Alt | GUI | App | Ctrl |
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO,\ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, M(0),\
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_NO, KC_APP, KC_RCTL \ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_NO, KC_APP, KC_RCTL \
), ),
/* /*
@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
| TRNS |Mute |Vol- |Play |PgDn | Del |Left |Down | Up |Right| | | | | TRNS |Mute |Vol- |Play |PgDn | Del |Left |Down | Up |Right| | | |
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
| | | | | | |DelWL|DelWR| | | | | | | | | | | |DelWL|DelWR| | | | | |
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
| | | | | TRNS | | | | | Reset | | | | | | TRNS | | | | | Reset |
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
@ -64,17 +64,16 @@ const uint16_t PROGMEM fn_actions[] = {
}; };
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
{
// MACRODOWN only works in this function
switch(id) { switch(id) {
case 0: case 0:
if (record->event.pressed) { // Sends Alt+Shift on both key down and key up.
register_code(KC_RSFT); // Fesigned to switch between two keyboard layouts on Windows using a locking switch.
} else { // Does nothing if right shift is pressed for easier resync.
unregister_code(KC_RSFT); if (!(get_mods() & MOD_BIT(KC_RSFT)))
} return MACRO(D(LALT), T(LSFT), U(LALT), END);
break; else
return MACRO_NONE;
} }
return MACRO_NONE; return MACRO_NONE;
}; };