split_space.c 653 B

1234567891011121314151617181920212223
  1. // Copyright 2022 David Kristoffersen (@davidkristoffersen)
  2. // SPDX-License-Identifier: GPL-3.0-or-later
  3. #include "split_space.h"
  4. #ifdef SPLIT_SPACE
  5. void handle_split_space(uint16_t keycode) {
  6. // Disable modifiers when numpad is active
  7. if (IS_LAYER_ON(NUMPAD)) clear_oneshot_mods();
  8. if (keycode == KC_LSPC) {
  9. // 2ng tap: Activate ctrl if shift is active
  10. if (get_oneshot_mods() & MOD_MASK_SHIFT) {
  11. clear_oneshot_mods();
  12. set_oneshot_mods(MOD_LCTL);
  13. }
  14. // 1st. tap: Activate shift if no modifier is active
  15. else {
  16. set_oneshot_mods(MOD_LSFT);
  17. }
  18. }
  19. }
  20. #endif