I think i missexplained my issue (my bad btw).
First of all, i can’t use oneshot because it recognize modifier keys such as mod, shift and other as input wich is not good for this purpose because need to use the full keymap (including mod and shift layer). the other reason i don’t use oneshot is because it times out pretty quickly even tho i know i can change this with the oneshotsettimeout or something like that;
2nd, the reason i don’t use delayuntilrelease is because in my experience it doesn’t wait for the macro i inputed to be finished but instead it wait for me to release the button.
the reason why I need to wait the end of the macro is that i got some very simple macros that takes millisecs and other that takes full seconds because of the maxinputspeed of my software (wich if i input too much informations in just starts to input some keypresses twice and forget about other).
here’s an example of one of the very long macros :
presskey lalt
tapkey b
tapkey b
releasekey lalt
writetext "-->"
tapkey leftarrow
tapkey downarrow
writetext "x->"
tapkey leftarrow
tapkey downarrow
writetext ">"
(i haven’t done the math but practically it takes about 1-2 secs to run)
and a very shot macro example could be tapkey lalt+F or writetext \frac.
i run 7ms keystrokedelay to prevent the macro form bothering my software that really doesn’t like it under 5ms (and 7ms for longer macros).
So as you can see, the problem seems to be easy at first but when diving in it gets quiet difficult (at least for me) and as my knowledge about condition and postponekeys is very limited i asked here (after 5 hours reading the github advanced doc and coding different macros that just wouldn’t work properly)
i currently use a macro that uses fixed delays but it make my mathematics writting slower as i need to wait for about 800ms before getting my keyboard back in AZERTY and it also prevents me from going too fast with simple macros as if you press it while the delay is not finished it can litterally lock on MAT keymap.
BTW the tapkey Lalt+ls are out of the command block, instead i’ve put tapkey blocks above and down, outside the command and selected shift and alt.
EDIT :
with the following command (based on what you provided me earlier), i finally got it to work but it still doesn’t wait for the macro i pressed to end to finish the process. the issue with that is that the the macro starts well but finish writting things like i pressed the buttons on a french keyboard replacing → by /q (or something like that) for example.
switchKeymap MAT
postponeKeys while (true) { // wait until another key is pressed
ifPending 1 break
delayUntil 1
}
while (true) {
// Break on some indicator that the macro has finished running
// The below may work, but a variable indicator would be better
ifNotPending 1 break // This probably breaks when the other macro starts, not when it ends
delayUntil 4
}
delayUntilRelease
switchKeymap QWR
To solve this issue my guess would’ve been to add a fixed delay and postpone any input that is done during this delay to then return it once the delay is finished (but i have no proof of concept that it would work or even be possible).
One other issue i’ve spotted while playing around with the macro is that it does not exclude the shift and mod so i need to hold it if i need to use mod and shift.
I’m sorry if this post is very long i’d understand if you gave up because my needs are pretty specific and i really thank you if you’ve made it this far.