1
0
Fork 0

Add game layer with qwerty and number row

This commit is contained in:
Sijmen 2018-12-31 20:51:22 +01:00
parent 863d59474b
commit 7517145260

View file

@ -20,6 +20,7 @@ enum {
_LSHIFT,
_RSHIFT,
_NUMBER,
_GAME,
_FUNCTION,
};
@ -37,8 +38,12 @@ qk_tap_dance_action_t tap_dance_actions[] = {
[TD_QUOT] = ACTION_TAP_DANCE_DOUBLE(KC_QUOT, S(KC_QUOT)),
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
enum planck_keycodes {
DEFAULT = SAFE_RANGE,
GAME
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Default
* ,-----------------------------------------------------------------------------------.
* | q | d | r | w | b | | | j | f | u | p | ; |
@ -129,7 +134,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{_______, _______, _______, _______, KC_LSFT, _______, _______, KC_RSFT, KC_0, KC_DOT, KC_U, KC_I},
},
/* Function
/* Game
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------|------+------+------+------+------+------|
@ -140,8 +145,26 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | LCTL | LALT | LGUI | ESC | LSFT | TAB | BSPC | RSFT | LEFT | DOWN | UP | RGHT |
* `-----------------------------------------------------------------------------------'
*/
[_GAME] = {
{KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SLSH},
{KC_LSFT, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT },
{KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_SPC, MO(_FUNCTION), KC_B, KC_N, KC_M, KC_COMM, KC_DOT },
},
/* Function
* ,-----------------------------------------------------------------------------------.
* | DFLT | GAME | | | | | | | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | LSFT | LSFT | | F5 | F6 | F7 | F8 |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | ENT | ENT | | F1 | F2 | F3 | F4 |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | LCTL | LALT | LGUI | ESC | LSFT | TAB | BSPC | RSFT | LEFT | DOWN | UP | RGHT |
* `-----------------------------------------------------------------------------------'
*/
[_FUNCTION] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12 },
{DEFAULT, GAME, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F9, KC_F10, KC_F11, KC_F12 },
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8 },
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4 },
{_______, _______, _______, _______, KC_LSFT, _______, _______, KC_RSFT, KC_LEFT, _______, _______, _______},
@ -172,3 +195,28 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
return MACRO_NONE;
};
static float default_song[][2] = SONG(QWERTY_SOUND);
static float game_song[][2] = SONG(COLEMAK_SOUND);
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case DEFAULT:
if (record->event.pressed) {
set_single_persistent_default_layer(_DEFAULT);
PLAY_SONG(default_song);
return false;
}
break;
case GAME:
if (record->event.pressed) {
set_single_persistent_default_layer(_GAME);
PLAY_SONG(game_song);
return false;
}
break;
}
return true;
}