Toggle value in $onLayerChange ? (different scroll speeds with the keycluster ball)

I want to change a keycluster value in the mod-layer.

The following works, but when the layer is left the value stays set. I can now define all other layers with the default value, but is there a better way to do that? Sort of toggle for the value in a specific layer?


Use case is the following. The mini trackball is IMO only usable for scrolling and nothing else really. But I almost never use it. Often it is too slow and other times it is too fast scrolling. So the solution is to set the scrolling speed low (to 3.5 for example) as the default, but when holding the MOD-key to scroll with a speed of 10.

EDIT: I needed to play around a bit till it was clear for me how the syntax of the $ macro needs to be. An example in the reference manual would help a lot – that goes also for other commands. :slight_smile: When you know the Autohotkey documentation that is a great example how an easy to understand command reference looks like.

You can reset it in $onLayerChange any.

1 Like

As to documentation, have you tried the user guide? If yes, what exactly is unclear about this example?

1 Like

I have overlooked that example. :blush: It is just so much text with both pages, that one easily misses the relevant part.

EDIT: reason for my oversight was that I was searching for onLayerChange. The example is for keymap changes. It is not hard to guess that the pattern also applies for the layer change, but when using search one will not find that example. With Autohotkey you typically have an example for every command. So the example is always close to the definition.

Ah, great. That is what any meant!? I thought it meant any layer…

but when using search one will not find that example

I see. That is a good point actually.

As for the documentation, we know that there is a lot left to be desired, and Laszlo has some vision ( see Unified smart macro documentation · Issue #647 · UltimateHackingKeyboard/firmware · GitHub ). Unfortunatelly, Laszlo and Robi seem to have more important priorities at the moment. And I personally lack the vision, as well as the platform (that Robi should eventually provide).

Ah, great. That is what any meant!? I thought it meant any layer…

It does mean any layer. But macro events are executed one after another from the most general to the most specific, so when you activate mod layer, first $onLayerChange any executes, setting “default” values and then $onLayerChange mod overwrites the resetted value.

1 Like