Keyboardio, what's pi to 9 digits?

So here’s what I’m hoping: I press a key mapped as M(PI_TO_THE_X_DIGITS) then type the digits of a number (x) and either let a timeout expire or press enter to actuate, and the macro outputs x+1 (because of the decimal point) characters from a given text (3.141592653 etc). Have another one for e, or the golden ratio, or the lyrics of the fresh prince of belair title theme.

Is something like that possible with the Macros plugin? I ask because the line I’ve seen on some macros (if (keyToggledOn(keyState)) ) implies to me that it is capable of having additional arguments involved.

Not that this is something I’d use all that much, to be honest. It would just be a kinda cool gimmick.

This seems more like a job for the Leader plugin.

2 Likes

Forgot about that plugin - pretty sure when I saw it I thought “yeah, that looks like it could make some fun gimmicks but nothing I’d use often” and forgot about it, even when I thought of a fun gimmick that I wouldn’t use often that it would facilitate!

I totally agree with merlin, in that the Leader plugin is probably be the most suitable among the stock plugins.

Also, I am currently working on a plugin called Kaleidoscope-Papageno. It does key event pattern recognition. I hope to release it soon. It’s features could be used to solve your problem. Key sequences similar to those of the Leader plugin are one of the features it supports, see here.

1 Like

Looks very useful, thank you!

@merlin @noseglasses

Just to get a better understanding of all available plugins:
Why would Leader be more suitable than plain Macros (maybe in combination with OneShot)?

(I’m still waiting for my Model 01, so I couldn’t try anything out yet.)

Macros acts on single key events only. While it would be possible to do this using Macros, it would be necessary to define all the number keys as Macro Keys, and it would be rather awkward.

Leader acts on sequences of key events. The idea here is to press π, then a number. The former would be defined as a Leader Key, and the following (number) key would determine the ensuing action. This is much more natural than using a whole bunch of Macros to accomplish the task.

With the Leader plugin (and Kaleidoscope-Papageno) you would define an independent leader sequence for every constant (pi, golden ration, …) and every level of accuracy (number of digits). Don’t forget to add the Enter key at the end of every sequence to solve the OP (timeout without confirming with Enter).

With the Leader plugin, every leader sequence triggers an action callback in case of a match. This callback is passed the sequence id (position in LEADER_DICT(...), starting from zero) as a function parameter. This makes it possible to reuse the same callback for all levels of accuracy of a constant, thereby reconstructing the level of accuracy from the sequence id argument.

OK, I just reread the “requirements” and saw only now that it also includes variable number of digits. I thought it’s only about typing pi to 9 digits.
I now understand the advantages of the Leader plugin here.
Thank you :blush:

Actually, not quite what I wanted but in some ways better and more fun, using TapDance to input one digit at a time of various constants would seem pretty simple to implement. I was thinking of making a Tapdance for certain letters to enable diacritics etc. (and which would give me even more incentive to learn to use redial to avoid that), which set me off on other possible uses of TapDance!

3.141592653

Remember to round correctly :wink: