-
-
Notifications
You must be signed in to change notification settings - Fork 39.8k
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
Keyboard combination triggers #960
Conversation
…er than COMBO_TERM
I'm haven't checked the actual implementation and what we already have in QMK. But isn't this very similar to Brainstorming on chording? |
Same concept different implementation. |
Cool! Thanks for adding :) |
@ofples This is exactly what I am looking for, can you show me a example how to use it in Keymap file? I am looking for pretty simple function say press |
@dunkarooftop Wow I totally forgot to add docs. Will try to get to that soon. Anyway, as you can probably see from my previous comment on this PR, my current implementation is flawed in that keys that are part of combos may fire in the wrong order if a combo isn't completed. In your In your And in
In this example hitting A+B would send the ESCAPE key. If you wanted to do something more complicated, you could override the
If your having any trouble (or if you find any bugs), feel free to message me. Good luck! |
@ofples dude, thank you sooo much this is working so well :) one question the time out time is set to I found it from
|
@ofples I get the 1st example to work but get some trouble try the more complex one, do you mind take a look at my hack? (I don't know C, everything I do is reading someone else's code and and guess) What I want to have is when press
and the error message I get it
Thank you again !! |
After some monkeying around, I change and fix the fallowing code:
It compile ok but now when ever I type EDIT: After trying a few different setting I think the problem is I use Is there a work around for this? :) |
I see, looks like you found a bug! |
@ofples Thank you for spending the time looking into it. :) On mac there is a really powerful tool call "Karabiner" it does have https://pqrs.org/osx/karabiner/xml.html.en Edit. Forget to mention the source code is on github |
@ofples |
@dunkarooftop |
@ofples One problem here, out of no where I start to get compile error, I pull the latest and did the simple tweak as in your example with only one combo on one the HHKB default keymap (not my crazy keymap) result the same error
Can you take a look when you have time thanks |
The warnings were turned into errors a few weeks ago, so that's the reason the changed behaviour. The easy fix is to change the array definition at the top of the file into this __attribute__ ((weak))
combo_t key_combos[COMBO_COUNT] = {
}; So that it includes the size. Ideally the array should not be weak and defined there at all, just declared so that you get a linker error if the keymap doesn't define it. |
@fredizzimo thanks for the reply :) I added your code to the top of
and get the fallowing error
|
You need to replace the current definition, the one without |
@fredizzimo |
@fredizzimo Do you know any other way to get around this? Or is it possible to disable warning become error so it can compile like before? I am a artist and my right hand is always holding a styles, that's why I need to cram everything I need to do on to the left hand. This combo function helps a lot with it. Thanks again. |
register_code16(keycode); | ||
send_keyboard_report(); | ||
unregister_code16(keycode); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this causes the issue #1370, reported by @dunkarooftop.
The code just blindly sends the keypress on release. The fix does not appear to be easy though, it would requre something similar to what are done for the actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @fredizzimo, sorry for rezzing an old thread but can you explain this a bit more? I'm developing a key profile for the gherkin that relies heavily on combos: http://www.keyboard-layout-editor.com/#/gists/3d8f9946bd7833f0e9938b63977443d9 and I'm starting to notice the out of order keys. When you say 'it would require something similar to what are done for the actions', do you mean directly above or in some other file somewhere? I'm new to this codebase, and it's been a while since I've done C, but my keymap requires this feature, so if it's in my power I'd love to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually that wasn't too crazy, I've got a proof of concept working with a global register. I'd love input around properly re-triggering records and their lifecycle but maybe that's more appropriately resolved in Gitter
This mail some how fall thru the crack, I just notice it. Thank you!! I will give it a try :)
Sent with [ProtonMail](https://protonmail.com) Secure Email.
… -------- Original Message --------
Subject: Re: [qmk/qmk_firmware] Keyboard combination triggers (#960)
Local Time: August 5, 2017 10:28 AM
UTC Time: August 5, 2017 5:28 PM
From: ***@***.***
To: qmk/qmk_firmware ***@***.***>
dunkarooftop ***@***.***>, Mention ***@***.***>
Hi. I have an idea.
I used similar solution [here](https://github.com/Giadpibtwyw/qmk_firmware/tree/master/keyboards/ergodox/keymaps/thumbshift_jp_osx) and somehow it worked.
I hope this would help you.
#include "timer.h"
#define M_W 20
#define M_F 21
#define M_T 22
#define WF_COPY 41 // M_W + M_F
#define WF_PASTE 42 // M_W + M_T
static unit16_t start;
static unit8_t previous_id;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = KEYMAP(
M(M_W), M(M_F), M(M_T))
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch(id) {
case M_W:
if(record -> event.pressed){
if(timer_elapsed(start) < 50){
switch(id + previous_id){
case WF_COPY:
return MACRO(I(1), T(BSPC), D(LGUI), T(C), U(LGUI), END);
case WF_PASTE:
return MACRO(I(1),T(BSPC), D(LGUI), T(V), U(LGUI), END);
}
} else {
start = timer_read();
previous_id = id;
return MACRO(T(W), END);
}
}
break;
case M_F:
if(record -> event.pressed){
if(timer_elapsed(start) < 50){
switch(id + previous_id){
case WF_COPY:
return MACRO(I(1), T(BSPC), D(LGUI), T(C), U(LGUI), END);
case WF_PASTE:
return MACRO(I(1),T(BSPC), D(LGUI), T(V), U(LGUI), END);
}
} else {
start = timer_read();
previous_id = id;
return MACRO(T(F), END);
}
}
break;
case M_T:
if(record -> event.pressed){
if(timer_elapsed(start) < 50){
switch(id + previous_id){
case WF_COPY:
return MACRO(I(1), T(BSPC), D(LGUI), T(C), U(LGUI), END);
case WF_PASTE:
return MACRO(I(1),T(BSPC), D(LGUI), T(V), U(LGUI), END);
}
} else {
start = timer_read();
previous_id = id;
return MACRO(T(T), END);
}
}
break;
}
return MACRO_NONE;
};
—
You are receiving this because you were mentioned.
Reply to this email directly, [view it on GitHub](#960 (comment)), or [mute the thread](https://github.com/notifications/unsubscribe-auth/AOLg4tI0sb980nhMPVwb2Lc-ufN_dMOYks5sVKYkgaJpZM4LPjFu).
|
Hi I can't compile it I get always this error: in my config.h i have: anyone can help me to build this? |
Couldn't use COMBO with RESET keycode. Had to use COMBO_ACTION and issue the reset using |
I added a feature that allows the user to specify key combos that trigger sending a keycode or calling a function.
For example: KC_Q + KC_W + KC_E could trigger the keyboard to reset.
Alternatively, it's also possible to have the combo call the
process_combo_event
function, passing as an argument the index of the combo in thekey_combos
array.I will soon document the full usage and features of this addition in the wiki.
Feel free to CR and comment on the code.