[Feature] Add keycode PDF(layer) to set the default layer in EEPROM (#24630)
* [Feature] Add keycode PDF(layer) to set the default layer in EEPROM (#21881) * Apply suggestions from code review Co-authored-by: Nick Brassel <nick@tzarc.org> --------- Co-authored-by: Nebuleon <2391500+Nebuleon@users.noreply.github.com> Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
parent
9e9b4acbde
commit
4a5bae51cd
14 changed files with 92 additions and 2 deletions
32
quantum/process_keycode/process_default_layer.c
Normal file
32
quantum/process_keycode/process_default_layer.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* Copyright 2023 Nebuleon
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "process_default_layer.h"
|
||||
#include "quantum.h"
|
||||
#include "quantum_keycodes.h"
|
||||
|
||||
#if !defined(NO_ACTION_LAYER)
|
||||
|
||||
bool process_default_layer(uint16_t keycode, keyrecord_t *record) {
|
||||
if (IS_QK_PERSISTENT_DEF_LAYER(keycode) && !record->event.pressed) {
|
||||
uint8_t layer = QK_PERSISTENT_DEF_LAYER_GET_LAYER(keycode);
|
||||
set_single_persistent_default_layer(layer);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // !defined(NO_ACTION_LAYER)
|
Loading…
Add table
Add a link
Reference in a new issue