Skip to content
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

Cannot Use Shifted Keys with Modifier/Tap Shortcut Mappings #642

Closed
common-nighthawk opened this issue Aug 16, 2016 · 9 comments
Closed

Comments

@common-nighthawk
Copy link
Contributor

SFT_T(KC_UNDS) does not work as expected. when tapped, it sends dash (-) rather than underscore (_).

i want to dig into this myself more. but i didn't see this reported as a bug.

presumably--because shift is an extra modifier to all the shortcut shifted keys, it's getting lost in this MT(MOD_LSFT, kc).

@algernon
Copy link
Contributor

My suspicion is that SFT_T will call register_code under the hood, which only supports 8bit keycodes, and thus no modifiers can be applied there.

@common-nighthawk
Copy link
Contributor Author

thanks for such a quick response. bummer for me.

is there any obvious workaround? something like MT(MOD_LSFT, KC_LSFT | KC_MINS)
(bleh... this seems very unlikely.)

[out of scope of this ticket, but i've found https://asylum.madhouse-project.org/blog/tags/ergodox/ incredibly helpful digging into all this. thank you!!!]

@algernon
Copy link
Contributor

The easiest way is likely a macro. When pressed, it starts a timer, and registers a shift. When released, it checks the timer, and if the elapsed time is smaller than TAPPING_TERM, it registers and unregisters - (and with Shift still being registered, that will turn into an underscore), and then unregisters Shift too.

Something like this:

case M_SUNDS:
  if (record->event.pressed) {
    sunds_timer = timer_read();
    register_code (KC_LSFT);
  } else {
    if (timer_elapsed (sunds_timer) > TAPPING_TERM) {
      register_code (KC_MINS);
      unregister_code (KC_MINS);
    }
    unregister_code (KC_LSFT);
  }
  break;

And somewhere near the top of your keymap, define the sunds_timer variable like this: static uint16_t sunds_timer.

Not tested, but should work, if it compiles. The downside of this is that the underscore registers on keyup, you can't hold it to let the OS repeat it, but you wouldn't be able to do that anyway, because when held, the key acts as shift.

Hope this helps!

@common-nighthawk
Copy link
Contributor Author

this is amazing! thank you so much--i really appreciate it. i will make the updates/flash later today.

@toneman77
Copy link
Contributor

Just for the sake of completeness: I tried algernon's code and it works...
...as soon as you change " > TAPPING_TERM" to " < TAPPING TERM".

@g-sam
Copy link
Contributor

g-sam commented Sep 25, 2016

an alternative quick fix is to look at where the space cadet feature is implemented in ./quantum/quantum.c and just copy it but change the relevant keys to whatever you want (you also need to add your new keycode in keymap.h).

@skullydazed
Copy link
Member

I'm closing this to clean up our open issues, but if you still have questions @common-nighthawk please reopen this or open a new issue.

@ELLIOTTCABLE
Copy link

It'd be really nice if this were a built-in feature, honestly. )=

@cattanimarco
Copy link

cattanimarco commented Jul 15, 2021

I think you just need to define RSPC_MOD to what you want

BlueTufa pushed a commit to BlueTufa/qmk_firmware that referenced this issue Aug 6, 2021
* update HS60 v2 ANSI keymap

* add HS60 v2 HHKB keymap

* add HS60 v2 ISO keymap
EKlaman pushed a commit to EKlaman/qmk_firmware that referenced this issue Feb 6, 2024
Add vial support for Cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants