From fc7587b672e9bce6fd7c2f9e0561ea7757e17fe2 Mon Sep 17 00:00:00 2001 From: Henry Bucklow Date: Sat, 5 Feb 2022 12:31:04 +0000 Subject: [PATCH] Added SPLIT_LAYER_STATE_SET option to invoke layer_state_set_kb and default_layer_state_set_kb on slave keyboard when state changes. This allows actions attached to these functions to be invoked on the slave side - for example, RGB light changes or haptic feedback. --- quantum/split_common/transactions.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/quantum/split_common/transactions.c b/quantum/split_common/transactions.c index 3ff87710e7e..2d7dd02123b 100644 --- a/quantum/split_common/transactions.c +++ b/quantum/split_common/transactions.c @@ -264,8 +264,20 @@ static bool layer_state_handlers_master(matrix_row_t master_matrix[], matrix_row } static void layer_state_handlers_slave(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) { - layer_state = split_shmem->layers.layer_state; - default_layer_state = split_shmem->layers.default_layer_state; + if (layer_state != split_shmem->layers.layer_state) { + layer_state = split_shmem->layers.layer_state; + +#if defined(SPLIT_LAYER_STATE_SET) + layer_state = layer_state_set_kb(layer_state); +#endif + } + if (default_layer_state != split_shmem->layers.default_layer_state) { + default_layer_state = split_shmem->layers.default_layer_state; + +#if defined(SPLIT_LAYER_STATE_SET) + default_layer_state = default_layer_state_set_kb(default_layer_state); +#endif + } } // clang-format off