Tidy up default layer handling in keymaps (#23436)
This commit is contained in:
		
							parent
							
								
									11deaf60b4
								
							
						
					
					
						commit
						ad8d934d3c
					
				
					 39 changed files with 50 additions and 417 deletions
				
			
		| 
						 | 
				
			
			@ -1,32 +0,0 @@
 | 
			
		|||
/*
 | 
			
		||||
This is the c configuration file for the keymap
 | 
			
		||||
 | 
			
		||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
 | 
			
		||||
Copyright 2015 Jack Humbert
 | 
			
		||||
 | 
			
		||||
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/>.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_USER_H
 | 
			
		||||
#define CONFIG_USER_H
 | 
			
		||||
 | 
			
		||||
#include "../../config.h"
 | 
			
		||||
 | 
			
		||||
/* Select hand configuration */
 | 
			
		||||
 | 
			
		||||
#define MASTER_LEFT
 | 
			
		||||
// #define MASTER_RIGHT
 | 
			
		||||
// #define EE_HANDS
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ extern keymap_config_t keymap_config;
 | 
			
		|||
#define _LOWER 3
 | 
			
		||||
#define _RAISE 4
 | 
			
		||||
#define _FN 5
 | 
			
		||||
#define _ADJUST 16
 | 
			
		||||
#define _ADJUST 6
 | 
			
		||||
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
  QWERTY = SAFE_RANGE,
 | 
			
		||||
| 
						 | 
				
			
			@ -161,11 +161,6 @@ 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:
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +168,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;
 | 
			
		||||
| 
						 | 
				
			
			@ -182,7 +177,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;
 | 
			
		||||
| 
						 | 
				
			
			@ -191,7 +186,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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue