diff --git a/generate_layout.rb b/generate_layout.rb index e5a87c9..ac84b9f 100755 --- a/generate_layout.rb +++ b/generate_layout.rb @@ -19,21 +19,17 @@ class Key Functions = { # down up - "basic" => [ "&kbfun_press_release", ], - "media" => [ "&kbfun_mediakey_press_release", ], - "toggle" => [ "&kbfun_toggle", ], - "transparent" => [ "&kbfun_transparent", ], + "basic" => [ "&kbfun_press_release", ], + "media" => [ "&kbfun_mediakey_press_release", ], + "toggle" => [ "&kbfun_toggle", ], + "transparent" => [ "&kbfun_transparent", ], # down up - "punc" => [ "&kbfun_layer_enable_1", "&kbfun_layer_disable_1" ], - "nav" => [ "&kbfun_layer_enable_2", "&kbfun_layer_disable_2" ], - "func" => [ "&kbfun_layer_enable_3", "&kbfun_layer_disable_3" ], - "latch_punc" => [ "&kbfun_layer_sticky_1", ], - "latch_nav" => [ "&kbfun_layer_sticky_2", ], - "latch_func" => [ "&kbfun_layer_sticky_3", ], + "layer" => [ "&kbfun_layer_enable", "&kbfun_layer_disable" ], + "latch" => [ "&kbfun_layer_sticky", ], # down up - "shifted" => [ "&kbfun_shift_press_release", ], - "ctrled" => [ "&kbfun_control_press_release", ], - "capslock" => [ "&kbfun_2_keys_capslock_press_release", ], + "shifted" => [ "&kbfun_shift_press_release", ], + "ctrled" => [ "&kbfun_control_press_release", ], + "capslock" => [ "&kbfun_2_keys_capslock_press_release", ], } Keys = { @@ -162,8 +158,6 @@ class Key "shift_r" => "KEY_RightShift", "scroll_lock" => "KEY_ScrollLock", # - "MOD" => "NULL", - # "NULL" => "NULL", # "audio_mute" => "MEDIAKEY_AUDIO_MUTE", @@ -187,9 +181,12 @@ class Key "browser_stop" => "MEDIAKEY_BROWSER_STOP", "browser_refresh" => "MEDIAKEY_BROWSER_REFRESH", "browser_bookmarks" => "MEDIAKEY_BROWSER_BOOKMARKS", - } + Layers.each.with_index do |layer, i| + Keys["#{layer}"] = "#{i}" + end + def initialize layers @layers = layers.map do |key, type| raise "key not found: #{key}" if not Keys.include? key and not key.nil? @@ -251,125 +248,125 @@ HEADER end keys = [ - # letter type punc type nav type func type - %w{ }, %w{ }, %w{ }, %w{ }, # dummy key - # - # left hand - # number - # letter type punc type nav type func type - %w{ 0 }, %w{ f11 }, %w{ f11 }, %w{ f11 }, # 1.5 - %w{ 1 }, %w{ f1 }, %w{ f1 }, %w{ f1 }, - %w{ 2 }, %w{ f2 }, %w{ f2 }, %w{ f2 }, - %w{ 3 }, %w{ f3 }, %w{ f3 }, %w{ f3 }, - %w{ 4 }, %w{ f4 }, %w{ f4 }, %w{ f4 }, - %w{ 5 }, %w{ f5 }, %w{ f5 }, %w{ f5 }, - %w{ 6 }, %w{ f6 }, %w{ f6 }, %w{ f6 }, - # top - # letter type punc type nav type func type - %w{ x }, %w{ ~ shifted }, %w{ escape }, %w{ }, # 1.5 - %w{ x }, %w{ ~ shifted }, %w{ escape }, %w{ }, - %w{ v }, %w{ [ }, %w{ backspace }, %w{ }, - %w{ l }, %w{ ' }, %w{ enter }, %w{ }, - %w{ c }, %w{ < shifted }, %w{ delete }, %w{ }, - %w{ w }, %w{ \\ }, %w{ insert }, %w{ }, - %w{ tab }, %w{ }, %w{ }, %w{ }, # 1.5 - # home - # letter type punc type nav type func type - %w{ umlaut }, %w{ }, %w{ }, %w{ }, # 1.5 - %w{ u }, %w{ , }, %w{ left }, %w{ f1 }, - %w{ i }, %w{ \{ shifted }, %w{ up }, %w{ f1 }, - %w{ a }, %w{ ? shifted }, %w{ down }, %w{ f1 }, - %w{ e }, %w{ ! shifted }, %w{ right }, %w{ f1 }, - %w{ o }, %w{ ( shifted }, %w{ tab }, %w{ f1 }, - # bottom - # letter type punc type nav type func type - %w{ shift_l capslock }, %w{ }, %w{ }, %w{ }, # 1.5 - %w{ % shifted }, %w{ ` }, %w{ home }, %w{ }, - %w{ * shifted }, %w{ ^ shifted }, %w{ page_up }, %w{ }, - %w{ : shifted }, %w{ | shifted }, %w{ page_down }, %w{ }, - %w{ p }, %w{ - }, %w{ end }, %w{ }, - %w{ z }, %w{ @ shifted }, %w{ }, %w{ }, - %w{ enter }, %w{ }, %w{ }, %w{ }, # 1.5 - # underbottom - # letter type punc type nav type func type - %w{ left }, %w{ }, %w{ }, %w{ }, - %w{ up }, %w{ }, %w{ }, %w{ }, - %w{ down }, %w{ }, %w{ }, %w{ }, - %w{ right }, %w{ }, %w{ }, %w{ }, - %w{ win }, %w{ }, %w{ }, %w{ }, - # thumb-top - # letter type punc type nav type func type - %w{ scroll_lock }, %w{ }, %w{ }, %w{ }, - %w{ MOD func }, %w{ }, %w{ }, %w{ }, - # thumb-double - # letter type punc type nav type func type - %w{ space }, %w{ }, %w{ }, %w{ }, - %w{ control }, %w{ }, %w{ }, %w{ }, - %w{ alt }, %w{ }, %w{ }, %w{ }, - # thumb-home - # letter type punc type nav type func type - %w{ space }, %w{ }, %w{ }, %w{ }, - %w{ control }, %w{ }, %w{ }, %w{ }, - %w{ alt }, %w{ }, %w{ }, %w{ }, - # - # right hand - # - # number - # letter type punc type nav type func type - %w{ 5 }, %w{ f5 }, %w{ f5 }, %w{ f5 }, # 1.5 - %w{ 6 }, %w{ f6 }, %w{ f6 }, %w{ f6 }, - %w{ 7 }, %w{ f7 }, %w{ f7 }, %w{ f7 }, - %w{ 8 }, %w{ f8 }, %w{ f8 }, %w{ f8 }, - %w{ 9 }, %w{ f9 }, %w{ f9 }, %w{ f9 }, - %w{ 0 }, %w{ f10 }, %w{ f10 }, %w{ f10 }, - %w{ 0 }, %w{ f12 }, %w{ f12 }, %w{ f12 }, - # top - # letter type punc type nav type func type - %w{ }, %w{ }, %w{ }, %w{ }, # 1.5 - %w{ k }, %w{ = }, %w{ 9 }, %w{ }, - %w{ h }, %w{ > shifted }, %w{ 5 }, %w{ }, - %w{ g }, %w{ " shifted }, %w{ 6 }, %w{ }, - %w{ f }, %w{ ] }, %w{ 7 }, %w{ }, - %w{ q }, %w{ ` }, %w{ 8 }, %w{ }, - %w{ q }, %w{ ` }, %w{ 8 }, %w{ }, # 1.5 - # home - # letter type punc type nav type func type - %w{ s }, %w{ ) shifted }, %w{ 0 }, %w{ }, - %w{ n }, %w{ _ shifted }, %w{ 1 }, %w{ }, - %w{ r }, %w{ / }, %w{ 2 }, %w{ }, - %w{ t }, %w{ \} shifted }, %w{ 3 }, %w{ }, - %w{ d }, %w{ . }, %w{ 4 }, %w{ }, - %w{ umlaut }, %w{ }, %w{ }, %w{ }, # 1.5 - # bottom - # letter type punc type nav type func type - %w{ enter }, %w{ }, %w{ }, %w{ }, # 1.5 - %w{ b }, %w{ + shifted }, %w{ 9 }, %w{ }, - %w{ m }, %w{ $ shifted }, %w{ 5 }, %w{ }, - %w{ j }, %w{ & shifted }, %w{ 6 }, %w{ }, - %w{ y }, %w{ # shifted }, %w{ 7 }, %w{ }, - %w{ ; }, %w{ ^ shifted }, %w{ 8 }, %w{ }, - %w{ shift_r capslock }, %w{ }, %w{ }, %w{ }, # 1.5 - # underbottom - # letter type punc type nav type func type - %w{ MOD nav }, %w{ }, %w{ }, %w{ }, - %w{ left }, %w{ }, %w{ }, %w{ }, - %w{ up }, %w{ }, %w{ }, %w{ }, - %w{ down }, %w{ }, %w{ }, %w{ }, - %w{ right }, %w{ }, %w{ }, %w{ }, - # thumb-top - # letter type punc type nav type func type - %w{ MOD punc }, %w{ }, %w{ MOD func }, %w{ }, - %w{ MOD nav }, %w{ MOD func }, %w{ }, %w{ }, - # thumb-double - # letter type punc type nav type func type - %w{ menu }, %w{ }, %w{ }, %w{ }, - %w{ alt }, %w{ }, %w{ }, %w{ }, - %w{ MOD latch_punc }, %w{ MOD punc }, %w{ NULL }, %w{ NULL }, - # thumb-home - # letter type punc type nav type func type - %w{ menu }, %w{ }, %w{ }, %w{ }, - %w{ alt }, %w{ }, %w{ }, %w{ }, - %w{ MOD latch_punc }, %w{ MOD punc }, %w{ NULL }, %w{ NULL }, + # letter type punc type nav type func type + %w{ }, %w{ }, %w{ }, %w{ }, # dummy key + # + # left hand + # number + # letter type punc type nav type func type + %w{ 0 }, %w{ f11 }, %w{ f11 }, %w{ f11 }, # 1.5 + %w{ 1 }, %w{ f1 }, %w{ f1 }, %w{ f1 }, + %w{ 2 }, %w{ f2 }, %w{ f2 }, %w{ f2 }, + %w{ 3 }, %w{ f3 }, %w{ f3 }, %w{ f3 }, + %w{ 4 }, %w{ f4 }, %w{ f4 }, %w{ f4 }, + %w{ 5 }, %w{ f5 }, %w{ f5 }, %w{ f5 }, + %w{ 6 }, %w{ f6 }, %w{ f6 }, %w{ f6 }, + # top + # letter type punc type nav type func type + %w{ x }, %w{ ~ shifted }, %w{ escape }, %w{ }, # 1.5 + %w{ x }, %w{ ~ shifted }, %w{ escape }, %w{ }, + %w{ v }, %w{ [ }, %w{ backspace }, %w{ }, + %w{ l }, %w{ ' }, %w{ enter }, %w{ }, + %w{ c }, %w{ < shifted }, %w{ delete }, %w{ }, + %w{ w }, %w{ \\ }, %w{ insert }, %w{ }, + %w{ tab }, %w{ }, %w{ }, %w{ }, # 1.5 + # home + # letter type punc type nav type func type + %w{ umlaut }, %w{ }, %w{ }, %w{ }, # 1.5 + %w{ u }, %w{ , }, %w{ left }, %w{ f1 }, + %w{ i }, %w{ \{ shifted }, %w{ up }, %w{ f1 }, + %w{ a }, %w{ ? shifted }, %w{ down }, %w{ f1 }, + %w{ e }, %w{ ! shifted }, %w{ right }, %w{ f1 }, + %w{ o }, %w{ ( shifted }, %w{ tab }, %w{ f1 }, + # bottom + # letter type punc type nav type func type + %w{ shift_l capslock }, %w{ }, %w{ }, %w{ }, # 1.5 + %w{ % shifted }, %w{ ` }, %w{ home }, %w{ }, + %w{ * shifted }, %w{ ^ shifted }, %w{ page_up }, %w{ }, + %w{ : shifted }, %w{ | shifted }, %w{ page_down }, %w{ }, + %w{ p }, %w{ - }, %w{ end }, %w{ }, + %w{ z }, %w{ @ shifted }, %w{ }, %w{ }, + %w{ enter }, %w{ }, %w{ }, %w{ }, # 1.5 + # underbottom + # letter type punc type nav type func type + %w{ left }, %w{ }, %w{ }, %w{ }, + %w{ up }, %w{ }, %w{ }, %w{ }, + %w{ down }, %w{ }, %w{ }, %w{ }, + %w{ right }, %w{ }, %w{ }, %w{ }, + %w{ win }, %w{ }, %w{ }, %w{ }, + # thumb-top + # letter type punc type nav type func type + %w{ scroll_lock }, %w{ }, %w{ }, %w{ }, + %w{ func layer }, %w{ }, %w{ }, %w{ }, + # thumb-double + # letter type punc type nav type func type + %w{ space }, %w{ }, %w{ }, %w{ }, + %w{ control }, %w{ }, %w{ }, %w{ }, + %w{ alt }, %w{ }, %w{ }, %w{ }, + # thumb-home + # letter type punc type nav type func type + %w{ space }, %w{ }, %w{ }, %w{ }, + %w{ control }, %w{ }, %w{ }, %w{ }, + %w{ alt }, %w{ }, %w{ }, %w{ }, + # + # right hand + # + # number + # letter type punc type nav type func type + %w{ 5 }, %w{ f5 }, %w{ f5 }, %w{ f5 }, # 1.5 + %w{ 6 }, %w{ f6 }, %w{ f6 }, %w{ f6 }, + %w{ 7 }, %w{ f7 }, %w{ f7 }, %w{ f7 }, + %w{ 8 }, %w{ f8 }, %w{ f8 }, %w{ f8 }, + %w{ 9 }, %w{ f9 }, %w{ f9 }, %w{ f9 }, + %w{ 0 }, %w{ f10 }, %w{ f10 }, %w{ f10 }, + %w{ 0 }, %w{ f12 }, %w{ f12 }, %w{ f12 }, + # top + # letter type punc type nav type func type + %w{ }, %w{ }, %w{ }, %w{ }, # 1.5 + %w{ k }, %w{ = }, %w{ 9 }, %w{ }, + %w{ h }, %w{ > shifted }, %w{ 5 }, %w{ }, + %w{ g }, %w{ " shifted }, %w{ 6 }, %w{ }, + %w{ f }, %w{ ] }, %w{ 7 }, %w{ }, + %w{ q }, %w{ ` }, %w{ 8 }, %w{ }, + %w{ q }, %w{ ` }, %w{ 8 }, %w{ }, # 1.5 + # home + # letter type punc type nav type func type + %w{ s }, %w{ ) shifted }, %w{ 0 }, %w{ }, + %w{ n }, %w{ _ shifted }, %w{ 1 }, %w{ }, + %w{ r }, %w{ / }, %w{ 2 }, %w{ }, + %w{ t }, %w{ \} shifted }, %w{ 3 }, %w{ }, + %w{ d }, %w{ . }, %w{ 4 }, %w{ }, + %w{ umlaut }, %w{ }, %w{ }, %w{ }, # 1.5 + # bottom + # letter type punc type nav type func type + %w{ enter }, %w{ }, %w{ }, %w{ }, # 1.5 + %w{ b }, %w{ + shifted }, %w{ 9 }, %w{ }, + %w{ m }, %w{ $ shifted }, %w{ 5 }, %w{ }, + %w{ j }, %w{ & shifted }, %w{ 6 }, %w{ }, + %w{ y }, %w{ # shifted }, %w{ 7 }, %w{ }, + %w{ ; }, %w{ ^ shifted }, %w{ 8 }, %w{ }, + %w{ shift_r capslock }, %w{ }, %w{ }, %w{ }, # 1.5 + # underbottom + # letter type punc type nav type func type + %w{ nav layer }, %w{ }, %w{ }, %w{ }, + %w{ left }, %w{ }, %w{ }, %w{ }, + %w{ up }, %w{ }, %w{ }, %w{ }, + %w{ down }, %w{ }, %w{ }, %w{ }, + %w{ right }, %w{ }, %w{ }, %w{ }, + # thumb-top + # letter type punc type nav type func type + %w{ punc layer }, %w{ }, %w{ func layer }, %w{ }, + %w{ nav layer }, %w{ func layer }, %w{ }, %w{ }, + # thumb-double + # letter type punc type nav type func type + %w{ menu }, %w{ }, %w{ }, %w{ }, + %w{ alt }, %w{ }, %w{ }, %w{ }, + %w{ punc latch }, %w{ punc layer }, %w{ NULL }, %w{ NULL }, + # thumb-home + # letter type punc type nav type func type + %w{ menu }, %w{ }, %w{ }, %w{ }, + %w{ alt }, %w{ }, %w{ }, %w{ }, + %w{ punc latch }, %w{ punc layer }, %w{ NULL }, %w{ NULL }, ].each_slice(Key::Layers.size).map do |layers| Key.new layers diff --git a/src/keyboard/ergodox/layout/saneo-mod.c b/src/keyboard/ergodox/layout/saneo-mod.c index 52937f3..00363be 100644 --- a/src/keyboard/ergodox/layout/saneo-mod.c +++ b/src/keyboard/ergodox/layout/saneo-mod.c @@ -46,7 +46,7 @@ KEY_DownArrow, KEY_RightArrow, KEY_LeftGUI, KEY_ScrollLock, -NULL, +3, KEY_Spacebar, KEY_LeftControl, KEY_LeftAlt, @@ -80,19 +80,19 @@ KEY_j_J, KEY_y_Y, KEY_Semicolon_Colon, KEY_RightShift, -NULL, +2, KEY_LeftArrow, KEY_UpArrow, KEY_DownArrow, KEY_RightArrow, -NULL, -NULL, +1, +2, KEY_Application, KEY_LeftAlt, -NULL, +1, KEY_Application, KEY_LeftAlt, -NULL), +1), KB_MATRIX_LAYER( NULL, @@ -169,13 +169,13 @@ NULL, NULL, NULL, NULL, +3, NULL, NULL, +1, NULL, NULL, -NULL, -NULL, -NULL), +1), KB_MATRIX_LAYER( NULL, @@ -251,7 +251,7 @@ NULL, NULL, NULL, NULL, -NULL, +3, NULL, NULL, NULL, @@ -378,7 +378,7 @@ const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS] = &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_enable_3, +&kbfun_layer_enable, &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, @@ -412,19 +412,19 @@ const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS] = &kbfun_press_release, &kbfun_press_release, &kbfun_2_keys_capslock_press_release, -&kbfun_layer_enable_2, +&kbfun_layer_enable, &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_enable_1, -&kbfun_layer_enable_2, +&kbfun_layer_enable, +&kbfun_layer_enable, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_sticky_1, +&kbfun_layer_sticky, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_sticky_1), +&kbfun_layer_sticky), KB_MATRIX_LAYER( &kbfun_transparent, @@ -501,13 +501,13 @@ KB_MATRIX_LAYER( &kbfun_transparent, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_enable_3, +&kbfun_layer_enable, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_enable_1, +&kbfun_layer_enable, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_enable_1), +&kbfun_layer_enable), KB_MATRIX_LAYER( &kbfun_transparent, @@ -583,7 +583,7 @@ KB_MATRIX_LAYER( &kbfun_transparent, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_enable_3, +&kbfun_layer_enable, &kbfun_transparent, &kbfun_transparent, &kbfun_transparent, @@ -710,7 +710,7 @@ const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS] = &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_disable_3, +&kbfun_layer_disable, &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, @@ -744,19 +744,19 @@ const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS] = &kbfun_press_release, &kbfun_press_release, &kbfun_2_keys_capslock_press_release, -&kbfun_layer_disable_2, +&kbfun_layer_disable, &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_disable_1, -&kbfun_layer_disable_2, +&kbfun_layer_disable, +&kbfun_layer_disable, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_sticky_1, +&kbfun_layer_sticky, &kbfun_press_release, &kbfun_press_release, -&kbfun_layer_sticky_1), +&kbfun_layer_sticky), KB_MATRIX_LAYER( &kbfun_transparent, @@ -833,13 +833,13 @@ KB_MATRIX_LAYER( &kbfun_transparent, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_disable_3, +&kbfun_layer_disable, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_disable_1, +&kbfun_layer_disable, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_disable_1), +&kbfun_layer_disable), KB_MATRIX_LAYER( &kbfun_transparent, @@ -915,7 +915,7 @@ KB_MATRIX_LAYER( &kbfun_transparent, &kbfun_transparent, &kbfun_transparent, -&kbfun_layer_disable_3, +&kbfun_layer_disable, &kbfun_transparent, &kbfun_transparent, &kbfun_transparent, diff --git a/src/lib/key-functions/public.h b/src/lib/key-functions/public.h index be834a8..f70ad4b 100644 --- a/src/lib/key-functions/public.h +++ b/src/lib/key-functions/public.h @@ -21,22 +21,10 @@ void kbfun_press_release_preserve_sticky (void); void kbfun_toggle (void); void kbfun_transparent (void); -// layer push/pop functions -#define define_layer(n) \ - void kbfun_layer_enable_##n (void); \ - void kbfun_layer_sticky_##n (void); \ - void kbfun_layer_disable_##n (void); - -define_layer(1); -define_layer(2); -define_layer(3); -define_layer(4); -define_layer(5); -define_layer(6); -define_layer(7); -define_layer(8); -define_layer(9); -define_layer(10); +// layer functions +void kbfun_layer_enable (void); +void kbfun_layer_sticky (void); +void kbfun_layer_disable (void); // device void kbfun_jump_to_bootloader (void); diff --git a/src/lib/key-functions/public/basic.c b/src/lib/key-functions/public/basic.c index c252918..482b0c2 100644 --- a/src/lib/key-functions/public/basic.c +++ b/src/lib/key-functions/public/basic.c @@ -65,17 +65,6 @@ void kbfun_transparent(void) { * layer functions * ------------------------------------------------------------------------- */ -// all lower layers on a key should be secretly set/unset to enable proper layer stacking -static void layers_enable_downwards(uint8_t layer) { - // TODO - main_layers_enable(layer, eStickyNone); -} - -static void layers_disable_downwards(uint8_t layer) { - // TODO - main_layers_disable(layer); -} - // enable given layer static void layer_enable(uint8_t layer) { // Only the topmost layer on the stack should be in sticky once state, pop @@ -85,12 +74,12 @@ static void layer_enable(uint8_t layer) { main_layers_disable_top(); } - layers_enable_downwards(layer); + main_layers_enable(layer, eStickyNone); } // disable given layer static void layer_disable(uint8_t layer) { - layers_disable_downwards(layer); + main_layers_disable(layer); } /* @@ -159,20 +148,18 @@ static void layer_sticky(uint8_t layer) { } } -// functions for all layers +// actual functions -#define define_layer(n) \ - void kbfun_layer_enable_##n (void) { layer_enable(n); } \ - void kbfun_layer_sticky_##n (void) { layer_sticky(n); } \ - void kbfun_layer_disable_##n (void) { layer_disable(n); } +void kbfun_layer_enable(void) { + uint8_t keycode = _kbfun_get_keycode(); + layer_enable(keycode); +} -define_layer(1); -define_layer(2); -define_layer(3); -define_layer(4); -define_layer(5); -define_layer(6); -define_layer(7); -define_layer(8); -define_layer(9); -define_layer(10); +void kbfun_layer_sticky(void) { + uint8_t keycode = _kbfun_get_keycode(); + layer_sticky(keycode); +} +void kbfun_layer_disable(void) { + uint8_t keycode = _kbfun_get_keycode(); + layer_disable(keycode); +} diff --git a/src/main.c b/src/main.c index c312a75..4e923f8 100644 --- a/src/main.c +++ b/src/main.c @@ -167,7 +167,8 @@ void main_layers_enable(uint8_t layer, uint8_t sticky) { void main_layers_disable(uint8_t layer) { if (layer >= KB_LAYERS) { return; } - layers[layer].active = false; + // base layer stays always on + if (layer > 0) { layers[layer].active = false; } if (layer >= layers_top) { layers_top = _highest_active_layer(1); }