~ruther/qmk_firmware

ref: 2c70d3891002337ef981a478b95c621f68dfd777 qmk_firmware/users/davidkristoffersen/hardware/split_space.c -rw-r--r-- 653 bytes
2c70d389 — leep-frog On-each-release tap dance function (#20255) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2022 David Kristoffersen (@davidkristoffersen)
// SPDX-License-Identifier: GPL-3.0-or-later

#include "split_space.h"

#ifdef SPLIT_SPACE
void handle_split_space(uint16_t keycode) {
    // Disable modifiers when numpad is active
    if (IS_LAYER_ON(NUMPAD)) clear_oneshot_mods();

    if (keycode == KC_LSPC) {
        // 2ng tap: Activate ctrl if shift is active
        if (get_oneshot_mods() & MOD_MASK_SHIFT) {
            clear_oneshot_mods();
            set_oneshot_mods(MOD_LCTL);
        }
        // 1st. tap: Activate shift if no modifier is active
        else {
            set_oneshot_mods(MOD_LSFT);
        }
    }
}
#endif