Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy up default layer handling in keymaps #23436

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions keyboards/dz60/keymaps/iso_split-spacebar/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ 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);
}

// always enable num lock on layer NL and disable on other layers
// thanks to spidey3 & Erovia on discord
layer_state_t layer_state_set_user(layer_state_t state) {
Expand Down
21 changes: 0 additions & 21 deletions keyboards/eco/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
#define _FN1 2
#define _FN2 3

enum eco_keycodes {
QWERTY = SAFE_RANGE
};

// Defines for task manager and such
#define CALTDEL LCTL(LALT(KC_DEL))
#define TSKMGR LCTL(LSFT(KC_ESC))
Expand Down Expand Up @@ -78,20 +74,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)

};

void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
persistant_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
}
return true;
}
11 changes: 3 additions & 8 deletions keyboards/handwired/atreus50/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,14 @@ float tone_colemak[][2] = SONG(COLEMAK_SOUND);

#endif

void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
Expand All @@ -128,7 +123,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
Expand All @@ -137,7 +132,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL<<_DVORAK);
set_single_persistent_default_layer(_DVORAK);
}
return false;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,3 @@ 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,3 @@ 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);
}

Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,3 @@ 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);
}
11 changes: 3 additions & 8 deletions keyboards/handwired/ortho5x13/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,14 @@ float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
#endif

void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
Expand All @@ -196,7 +191,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
Expand All @@ -205,7 +200,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL<<_DVORAK);
set_single_persistent_default_layer(_DVORAK);
}
return false;
break;
Expand Down
15 changes: 7 additions & 8 deletions keyboards/handwired/promethium/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,9 +940,8 @@ 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);
void persistent_default_layer_set(uint8_t default_layer) {
set_single_persistent_default_layer(default_layer);
#ifdef RGBSPS_ENABLE
led_set_default_layer_indicator();
#endif
Expand Down Expand Up @@ -1119,38 +1118,38 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// layout switchers
case QWERTY:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_QWERTY);
persistent_default_layer_set(_QWERTY);
}
return false;
break;
#ifdef LAYOUT_DVORAK
case DVORAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_DVORAK);
persistent_default_layer_set(_DVORAK);
}
return false;
break;
#endif
#ifdef LAYOUT_COLEMAK
case COLEMAK:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_COLEMAK);
persistent_default_layer_set(_COLEMAK);
}
return false;
break;
#endif
#ifdef LAYOUT_WORKMAN
case WORKMAN:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_WORKMAN);
persistent_default_layer_set(_WORKMAN);
}
return false;
break;
#endif
#ifdef LAYOUT_NORMAN
case NORMAN:
if (record->event.pressed) {
persistent_default_layer_set(1UL<<_NORMAN);
persistent_default_layer_set(_NORMAN);
}
return false;
break;
Expand Down
5 changes: 0 additions & 5 deletions keyboards/handwired/terminus_mini/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

};

void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}

// Cases to switch default layer to QWERTY, COLEMAK or DVORAK and to access ADJUST layer
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
Expand Down
11 changes: 3 additions & 8 deletions keyboards/helix/pico/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
bool TOG_STATUS = false;
int RGB_current_mode;

void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}

// Setting ADJUST layer RGB back to default
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
Expand All @@ -203,7 +198,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
Expand All @@ -212,7 +207,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
Expand All @@ -221,7 +216,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL<<_DVORAK);
set_single_persistent_default_layer(_DVORAK);
}
return false;
break;
Expand Down
11 changes: 3 additions & 8 deletions keyboards/helix/rev2/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
bool TOG_STATUS = false;
int RGB_current_mode;

void persistent_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}

// Setting ADJUST layer RGB back to default
void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
Expand All @@ -215,7 +210,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
persistent_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
Expand All @@ -224,7 +219,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
persistent_default_layer_set(1UL<<_COLEMAK);
set_single_persistent_default_layer(_COLEMAK);
}
return false;
break;
Expand All @@ -233,7 +228,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
persistent_default_layer_set(1UL<<_DVORAK);
set_single_persistent_default_layer(_DVORAK);
}
return false;
break;
Expand Down
9 changes: 1 addition & 8 deletions keyboards/kagizaraya/halberd/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ enum layer_names {

// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
QWERTY = SAFE_RANGE,
LOWER,
LOWER = SAFE_RANGE,
RAISE,
ADJUST,
};
Expand Down Expand Up @@ -112,12 +111,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
// persistant_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ enum layer_names {

// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
QWERTY = SAFE_RANGE,
LOWER,
LOWER = SAFE_RANGE,
RAISE,
ADJUST,
};
Expand Down Expand Up @@ -112,12 +111,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
// persistant_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
Expand Down
10 changes: 1 addition & 9 deletions keyboards/kagizaraya/miniaxe/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ enum layer_names {
};

enum custom_keycodes {
QWERTY = SAFE_RANGE,
LOWER,
LOWER = SAFE_RANGE,
RAISE,
ADJUST,
};
Expand Down Expand Up @@ -112,13 +111,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
// persistant_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
Expand Down
10 changes: 1 addition & 9 deletions keyboards/kagizaraya/miniaxe/keymaps/underglow/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ enum layer_names {
};

enum custom_keycodes {
QWERTY = SAFE_RANGE,
LOWER,
LOWER = SAFE_RANGE,
RAISE,
ADJUST,
};
Expand Down Expand Up @@ -112,13 +111,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
// persistant_default_layer_set(1UL<<_QWERTY);
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
Expand Down
Loading
Loading