mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 04:43:02 +00:00
4c6ce12d2a
* Fixed Left Shift tapdance in general and for gaming mode. (#12) * update ISO readme * left shift fixed in general, including for gaming mode * fixed toggle menu rendering on ISO layouts * updated readme's and cosmetics * update readme's * update readme's again * readme cosmetics * consolidate readme's * more readme cosmetics * clarification for bootloader mode on ISO * Autocorrect added with 400 word English dictionary (#13) * autocorrect added with 400 word dictionary * update readme's for autocorrect * Add FN-B as shortcut to bootloader * Update .gitignore Co-authored-by: Joel Challis <git@zvecr.com> * RGB changes to system numlock and ISO extended alphas - hide system numlock off indicator (primarily for Mac users) by moving it to numpad and FN layers instead - give users with extended alpha ISO languages a config option to add RGB highlights for extras alphas on capslock * readme updates * Fixed [FN]B and [FN]N shortcuts not working on numpad layer Co-authored-by: Joel Challis <git@zvecr.com>
102 lines
3.4 KiB
C
102 lines
3.4 KiB
C
// Copyright 2022 Google LLC
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#pragma once
|
|
|
|
#include "gourdo1.h"
|
|
|
|
static bool process_capsnum(uint16_t keycode, keyrecord_t * record) {
|
|
static bool toggled = false;
|
|
static bool tapped = false;
|
|
static uint16_t tap_timer = 0;
|
|
|
|
if (keycode == CAPSNUM) {
|
|
if (user_config.double_tap_shift_for_capslock) {
|
|
// Act as TT(_NUMPADMOUSE)
|
|
if (record -> event.pressed) { // CAPSNUM key was pressed
|
|
// Check whether the key was recently tapped
|
|
if (tapped && !timer_expired(record -> event.time, tap_timer)) {
|
|
// This is a double tap (or possibly a triple tap or more)
|
|
// Toggle the layer on.
|
|
toggled = true;
|
|
} else if (toggled) {
|
|
// Otherwise if currently toggled, turn it off
|
|
toggled = false;
|
|
tapped = false;
|
|
layer_off(_NUMPADMOUSE);
|
|
}
|
|
// Set that the first tap occurred in a potential double tap
|
|
tapped = true;
|
|
tap_timer = record -> event.time + TAPPING_TERM;
|
|
layer_on(_NUMPADMOUSE);
|
|
} else if (!toggled) {
|
|
// If not currently toggled, turn off on key release
|
|
layer_off(_NUMPADMOUSE);
|
|
return false;
|
|
}
|
|
} else { // When double_tap_shift_for_capslock == false
|
|
// Act as KC_CAPS
|
|
if (record -> event.pressed) {
|
|
register_code(KC_CAPS);
|
|
} else {
|
|
unregister_code(KC_CAPS);
|
|
}
|
|
}
|
|
return false;
|
|
} else {
|
|
// On an event with any other key, reset the double tap state
|
|
tapped = false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static bool process_esc_to_base(uint16_t keycode, keyrecord_t * record) {
|
|
static bool tapped = false;
|
|
static uint16_t tap_timer = 0;
|
|
|
|
if (keycode == KC_ESC) {
|
|
if (user_config.esc_double_tap_to_baselyr) {
|
|
if (record -> event.pressed) {
|
|
if (tapped && !timer_expired(record -> event.time, tap_timer)) {
|
|
// The key was double tapped.
|
|
layer_clear();
|
|
}
|
|
tapped = true;
|
|
tap_timer = record -> event.time + TAPPING_TERM;
|
|
}
|
|
}
|
|
} else {
|
|
// On an event with any other key, reset the double tap state.
|
|
tapped = false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static bool process_lsft_for_caps(uint16_t keycode, keyrecord_t * record) {
|
|
static bool tapped = false;
|
|
static uint16_t tap_timer = 0;
|
|
|
|
if (keycode == KC_LSFT) {
|
|
if (user_config.double_tap_shift_for_capslock) {
|
|
if (!keymap_config.no_gui) {
|
|
if (record->event.pressed) {
|
|
if (tapped && !timer_expired(record->event.time, tap_timer)) {
|
|
// The key was double tapped.
|
|
//clear_mods(); // If needed, clear the mods.
|
|
// Do something interesting...
|
|
register_code(KC_CAPS);
|
|
}
|
|
tapped = true;
|
|
tap_timer = record->event.time + TAPPING_TERM;
|
|
} else {
|
|
unregister_code(KC_CAPS);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
// On an event with any other key, reset the double tap state.
|
|
tapped = false;
|
|
}
|
|
return true;
|
|
}
|