Implicit feature: Custom shift keys can make Layer Tap layers with advanced keycodes #44
Replies: 2 comments 4 replies
-
@humanplayer2 thanks for sharing this! To check that I understand the described idea: the result is that pressing Implementation does get more involved to define both custom shift and custom rgui behaviors. Potentially another approach is in terms of QMK's Key Overrides. Key Overrides has a lot of flexibility beyond what Custom shift keys does. Something like const key_override_t lag_b_key_override = // RShift + A is Left Alt + Left GUI + B
ko_make_basic(MOD_BIT(KC_RSFT), KC_A, LAG(KC_B));
const key_override_t ctrl_v_key_override = // RGUI + , is Ctrl + V
ko_make_basic(MOD_BIT(KC_RGUI), KC_COMM, C(KC_V)); Of course, writing mod handling code yourself is potentially even more flexible, and more fun =) |
Beta Was this translation helpful? Give feedback.
-
@humanplayer2 is this any different than intercepting the tap behaviour of an ie, I want to have a key where it changes layer on hold, and sends So I define my layer-tap key with a basic keycode, ie #define LS_SNUM LT(SNUM, KC_3) // The tap is intercepted later to send "}" and then later in switch (keycode) {
case LS_SNUM:
if (record->event.pressed && record->tap.count != 0) {
tap_code16(KC_RCBR);
return false;
}
return true;
} and hence I have a layer-tap key with a non-basic keycode. I couldn't quite wrap my head around what you described, does it accomplish anything different, or is it the same thing with a different flavour? Not trying to judge or anything, just curious and trying to understand! |
Beta Was this translation helpful? Give feedback.
-
QMK's layer tap option
LT(layer, kc)
only supports basic keycodes in thelayer
---but this can be (partially) circumvented using thecustom_shift_keys
feature from this repo!First observation is that Custom shift keys as-is supports overriding the default shift behavior with advanced keycodes. Having set up Custom shift keys as described in the blog post, we can set up our shift keys (both left and right) to send an advanced keycode. E.g., this makes
Shift + A
sendLeft Alt + Left GUI + B
:Second observation is that our custom shift keys can be used in combination with Mod-Tap as normally. In our keymap, we can set e.g.
C
as a tap-mod key usingCool! Now we have a tap-hold key that sends an advanced keycode---and if we didn't need our shift keys, we could define a full layer using a long list of remappings in
custom_shift_key_t custom_shift_keys
.Third observation is that we can quite straightforwardly augment the Custom shift keys code to support Control, Alt and GUI, and to differentiate left and right versions of these mods.
E.g., to include a custom
RGUI
key, leavingLGUI
as default, do the following:In
custom_shift_keys.c
:Duplicate all the code below the original, so you have it twice. In the new code, replace:
-
process_custom_shift_keys
withprocess_custom_rgui_keys
-
MOD_MASK_SHIFT
withMOD_BIT(KC_RIGHT_GUI)
-
NUM_CUSTOM_SHIFT_KEYS
withNUM_CUSTOM_RGUI_KEYS
-
custom_shift_keys
withcustom_rgui_keys
-
MOD_LSFT
withMOD_RGUI
In
custom_shift_keys.h
:Duplicate all the code below the original, so you have it twice. In the new code, replace:
shifted_keycode
withrguied_keycode
custom_shift_key_t
withcustom_rgui_key_t
custom_shift_key_t custom_shift_keys
withcustom_shift_key_t custom_shift_keys
NUM_CUSTOM_SHIFT_KEYS
withNUM_CUSTOM_RGUI_KEYS
process_custom_shift_keys
withprocess_custom_rgui_keys
In
keymap.c
:Use
custom_rgui_key_t custom_rgui_keys
to define your layer (and setNUM_CUSTOM_RGUI_KEYS
)Include
process_custom_rgui_keys
inprocess_record_user
(maybe along withprocess_custom_shift_keys
, as here):Finally, add
RGUI
in a mod-tap as a keycode in your keymap---e.g.(MT(MOD_RGUI,KC_SPACE))
--- and enjoy your mod-tap/layer-tap layer with advanced keycodes!The above can then be repeated for other default mods, which at least allows for a handful of layers.
Disclaimer
I haven't tested this with any advanced keycodes apart from modifiers such as
C(kc)
andLAG(kc)
.Beta Was this translation helpful? Give feedback.
All reactions