ifDoubleTap else oneShot command

Hello! Could anyone help showing how can I achieve this

ifDoubletap {
    ifLayer base {
        toggleLayer shift
        final setLedTxt 0 "SHF"
    }
    ifLayer shift {
        toggleLayer base
        final setLedTxt 0 "BAS"  
    }
} else {
    oneShot holdKey RS-
}

So what I want to get…

  1. If I press key once it works as shift waiting until I press another key. As soon as I press another key shift is deactivated.
  2. If I double tap key it works as prolonged shift, like I hold shift indefinitely. Thus I can type SOMELONGTEXT easily.
  3. If I in mode 2 - double tap key returns me back to usual mode (shift is not hold). Double tap - for consistency.

If I’m correct there is no problems with these interactions, at least I can’t see.

And I think relevant question

How to allow to switch led text with seLedTxt only for the duration of oneshot command

Whenever oneshot command finished executing led text should automatically return back to it’s original value.

Well, is there any problem with the code above?

Else needs to be on a new line. Apart from that it looks like it should work.

How to allow to switch led text with seLedTxt only for the duration of oneshot command

setLedTxt 0 "<your text>"
oneShot holdKey RS-
setLedTxt 1 "   " 

It worked, but there was one problem. If I double tap, not only I get layer switch, but also as if I additionally pressed shift one more time.

What do you mean by “additionally pressed shift one more time”?

ifDoubletap only triggers on the second tap, so the first tap will trigger the else clause.

If you want the macro to query for future strokes, you will need to replace ifDoubletap by ifGesture $thisKeyId. E.g.:

ifGesture $thisKeyId {
    ifLayer base {
        toggleLayer shift
        final setLedTxt 0 "SHF"
    }
    ifLayer shift {
        toggleLayer base
        final setLedTxt 0 "BAS"  
    }
} 
else {
    oneShot holdKey RS-
}

1 Like

Not sure if the last answer worked, but I’ve been doing this for ages using this macro. It’s not as cool as the spiffy code lol, but it does exactly what you describe you want to do:

image

Btw, @UHQueefboard, you can write both commands into a single </> Command entry box. Is there a reason why you kept them separate?

Legacy from my initial learning lol

Followed by adherence to the principle of “if it’s working, don’t touch it” :smiley: :smiley: :smiley:

But yeah I should go thru and condense all the commands I have split.

I’ve updated to the latest firmware and have not had an instance of the issue occurring as yet. Would have normally had a few by now, so fingers crossed!!!

Thanks again for all the help & work on this one, much appreciated.

It’s been over a full day now with no errors - woot!!!