-
-
Notifications
You must be signed in to change notification settings - Fork 37.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combining Shift with certain characters #50
Comments
+1 for this issue |
Just a quick explanation of why this is - the It's possible to do this, but my guess is that it'll need to be a custom function/framework. |
@majutsushi Does this work?
|
@Eric-L-T Just gave that shot and it did the trick! Thanks a lot for the suggestion :) More detail for anyone else that needs to do this:
Now all you have to do is use M(HOLD_SHIFT_TAP_TILDA) or M(1) in your keymap to have tap/hold functionality with higher value characters. |
@Eric-L-T @jackhumbert I'm not sure that this is sufficient to implement the original shift-parentheses feature. There may be an issue with executing multiple macros at once, or there is some additional complexity that is not being taken into account. If both shift keys are pressed at overlapping intervals, such as can happen when typing This is what I have: // Max duration that counts as a tap (ms)
#ifndef TAPPING_TERM
#define TAPPING_TERM 150
#endif
// Special macros
#define LSFT_PAREN 0
#define RSFT_PAREN 1
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
static uint16_t start[2];
switch(id) {
case LSFT_PAREN:
if (record->event.pressed) {
start[LSFT_PAREN] = timer_read();
return MACRO(D(LSFT), END);
} else {
if (timer_elapsed(start[LSFT_PAREN]) > TAPPING_TERM) {
return MACRO(U(LSFT), END);
} else {
return MACRO(T(9), U(LSFT), END);
}
}
break;
case RSFT_PAREN:
if (record->event.pressed) {
start[RSFT_PAREN] = timer_read();
return MACRO(D(RSFT), END);
} else {
if (timer_elapsed(start[RSFT_PAREN]) > TAPPING_TERM) {
return MACRO(U(RSFT), END);
} else {
return MACRO(T(0), U(RSFT), END);
}
}
break;
}
} |
Ah, that's likely to do the one timer variable being used - you're not having that problem when using the two, right? I'd throw the |
No, I'm afraid I'm experiencing the issue even with multiple timers. I'm actually not so sure when exactly the issue is triggered. I was just now able to press both shift keys together a couple times with reasonable results before it locked up into this strange state again. Here's the full keymap file for reference: https://gist.github.com/noahfrederick/353457890c8bcae4671a |
I don't know whether that's your issue but remember that pressing both shift keys at the same time is the Magic key combination, which allows you to turn on debug mode, or change the default layer by pressing Magic+number. Magic is If you switch to an unused layer, its sometimes impossible to come back… As far as I can tell this would be reset when unplugging the keyboard, but I think are read somewhere that it is possible to make some parameters persistent. |
Ah, yeah - that sounds right. @noahfrederick Check your config.h to change the IS_COMMAND() definition, and see if the weirdness still happens. |
@DidierLoiseau I think you hit on the problem.
My mistake. That is indeed the case here. I can unplug the keyboard to restore it.
Yep, that seems to have done the trick. Thanks. Note: I made a modification to avoid typing static uint16_t start[6];
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case LSFT_PAREN:
if (record->event.pressed) {
start[LSFT_PAREN] = timer_read();
return MACRO(D(LSFT), END);
} else {
if (timer_elapsed(start[LSFT_PAREN]) > TAPPING_TERM) {
return MACRO(U(LSFT), END);
} else {
return MACRO(D(LSFT), T(9), U(LSFT), END);
}
}
break;
case RSFT_PAREN:
if (record->event.pressed) {
start[RSFT_PAREN] = timer_read();
return MACRO(D(RSFT), END);
} else {
if (timer_elapsed(start[RSFT_PAREN]) > TAPPING_TERM) {
return MACRO(U(RSFT), END);
} else {
return MACRO(D(RSFT), T(0), U(RSFT), END);
}
}
break;
}
} |
Awesome! |
@noahfrederick - revisiting this because I'm interested in the feature; is your keymap anywhere on github? |
@ezuk Sure. It's here: https://github.com/noahfrederick/dots/blob/51bd77988eb6a1b368281196df0280b51b0ca0e9/planck/keymap.c It turns out this implementation needs some refinement, though. As I've gotten faster at typing on the Planck, I'm more and more often typing an unwanted parenthesis after a capital, because the time I'm holding shift doesn't exceed |
A fellow Fish user! That's awesome :) And yes -- I agree re the need to detect another key. This is a good starting point though, thank you! |
Add compiled HID bootloader CLI binary to .gitignore.
Fix issue with Split Common backlight disabling
add vial support for Sofle and its encoders
I am trying to replicate the Shift-key functionality that Steve Losh described here: http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses . The idea is that tapping the Shift key produces a left or right parenthesis, respectively, and holding it results in the normal shifted functionality. Unfortunately this doesn't work for me with this firmware; if I try to do it the obvious way with
SFT_T(KC_LPRN)
then tapping the key produces a9
, not a(
. This has probably to do with the fact that the parenthesis is a shifted 9, but it would be great if this could work regardless.The text was updated successfully, but these errors were encountered: