Skip to content

[Macros] Behavior of detecting key release while postponing #1493

@firngrod

Description

@firngrod

Say I have a macro bound to shift which does the following:

postponeKeys holdKey leftShift

Say I do the following:

  • press shift
  • tap a
  • release shift

a should intuitively be capitalized, but it's not because the holdKey is terminated before the queue is unrolled.

Solving this is not simple, but it may be doable. Maybe make the key release break the postpone for commands which wait for release, but let the scope live until release unroll from the queue? That would get complex with structures like

ifReleased {
  doStuff
  break
}

Maybe it's not doable, but I wanted to raise the issue anyway.

Maybe the solution is to make a delayUntilPostponedRelease style command which waits for release ignoring the postponed events and errors out if it's called in a postponed scope? Then that command along with pressKey could be used to create any wanted effect explicitly.

I used the simplest macro which demonstrates the issue in the example, and it is in itself a useless macro, but other macros with similar structure may cause issues as well, such as the following triggering secondary on a negative safety margin, which could break the holdKey in the trailing postponed cycle?

ifSecondary holdKey leftShift
else doPrimaryStuff

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions