mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-11 02:59:09 +00:00
Keyboard: Lets split eh default keymap - Fixes for superseded default layer functionality (#4581)
* Fixes for superseded default layer functionality * Fixes for superseded default layer functionality
This commit is contained in:
parent
4446f86bfd
commit
cb149650ef
3 changed files with 12 additions and 66 deletions
|
@ -18,9 +18,6 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
#pragma once
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
#endif
|
||||
// place overrides here
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
#include "action_layer.h"
|
||||
#include "eeconfig.h"
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
#define _QWERTY 0
|
||||
|
||||
#define _LOWER 3
|
||||
#define _RAISE 4
|
||||
#define _FUNCTION 15
|
||||
#define _ADJUST 16
|
||||
|
||||
enum custom_keycodes {
|
||||
QWERTY = SAFE_RANGE,
|
||||
LOWER,
|
||||
RAISE,
|
||||
ADJUST
|
||||
};
|
||||
|
||||
// Fillers to make layering more clear
|
||||
#define _______ KC_TRNS
|
||||
#define XXXXXXX KC_NO
|
||||
#define LOWER MO(_LOWER)
|
||||
#define RAISE MO(_RAISE)
|
||||
#define FUNCTION MO(_FUNCTION)
|
||||
#define ADJUST MO(_ADJUST)
|
||||
|
||||
// Defines for task manager and such
|
||||
#define CALTDEL LCTL(LALT(KC_DEL))
|
||||
|
@ -45,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_QWERTY] = LAYOUT( \
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||
MO(_FUNCTION), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \
|
||||
FUNCTION, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, \
|
||||
OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT, \
|
||||
KC_LCTL, KC_GRV, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
|
||||
),
|
||||
|
@ -90,7 +79,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
* ,-----------------------------------------------------------------------------------.
|
||||
* |Taskmg| | | | | | | |RGBVAI|RGBSAI|RGBHUI|caltde|
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | | | | | |Qwerty|RGBVAD|RGBSAD|RGBHUD|RGBTOG|
|
||||
* | | | | | | | | |RGBVAD|RGBSAD|RGBHUD|RGBTOG|
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | |BLSTEP|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
|
@ -99,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
*/
|
||||
[_ADJUST] = LAYOUT( \
|
||||
TSKMGR, _______, _______, _______, _______, _______, _______, _______, RGB_VAI, RGB_SAI, RGB_HUI, CALTDEL, \
|
||||
_______, _______, _______, _______, _______, _______, _______, QWERTY, RGB_VAD, RGB_SAD, RGB_HUD, RGB_TOG, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, RGB_VAD, RGB_SAD, RGB_HUD, RGB_TOG, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, BL_STEP, \
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET \
|
||||
),
|
||||
|
@ -124,47 +113,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
};
|
||||
|
||||
void persistent_default_layer_set(uint16_t default_layer) {
|
||||
eeconfig_update_default_layer(default_layer);
|
||||
default_layer_set(default_layer);
|
||||
uint32_t layer_state_set_user(uint32_t state) {
|
||||
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
persistent_default_layer_set(1UL<<_QWERTY);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case LOWER:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_LOWER);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_LOWER);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case RAISE:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_RAISE);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
} else {
|
||||
layer_off(_RAISE);
|
||||
update_tri_layer(_LOWER, _RAISE, _ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case ADJUST:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_ADJUST);
|
||||
} else {
|
||||
layer_off(_ADJUST);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
Loading…
Reference in a new issue