Add 'value of variable' to 'Advanced Conditions' in 'Trigger Conditions'

This came out of an idea I had in Add modifier keys and other keyboard keys to 'Advanced Conditions' in 'Trigger Conditions'

Specifically:

It would be really cool if we were able to check the value of an assigned variable from the 'Advanced Conditions' 'Trigger Conditions'.

That way I could have one trigger set up (eg. long-press b) that would assign a value to a variable (eg. isBLongPressed = true); and then could set up another trigger that will only activate when isBLongPressed == true (as would be assigned in the 'trigger conditions')


I suspect it might already be possible to achieve this by writing some code in a 'real JavaScript' workflow, or possibly with this new upcoming feature you mentioned; but I think being able to access it in the 'Trigger Conditions' workflow would make it more accessible than having to resort to code:

Once you have assigned a value to the variable, it will show up in the advanced trigger conditions (on the bottom of the dropdown list) and you can use it!

1 Like

Oh true! I had no idea, that's awesome!

I wonder if it would be possible to add some kind of disabled placeholder to that dropdown when no variables are assigned. Possible a 'horizontal line break' before the custom variables, and then a disabled option 'No custom variables' or similar. That would sort of 'hint' to me through the UI that the feature exists there, and I just need to do something different (assign a variable) for it to become active; whereas currently, with nothing showing, I just assume that it isn't possible at all.

Unfortunately the condition builder is currently a standard macOS UI component, which only offers very limited customization options. But adding a line might be possible, I'll have a look!
At some point I'll need to switch to a custom component...

1 Like

Ah, true. Even if it's just hinted at in the UI somewhere, that would work!


Also, another potential improvement, I just configured the 'Assign Value to Variable' on a trigger, but I haven't activated it yet:

And presumably because I haven't activated it yet, it's not showing in the advanced trigger conditions list.

While obviously I could work around this by just triggering it first; it would be super useful/helpful for discovery of the feature if the advanced trigger conditions could show any of the variables I have configured in 'Assign Value to Variable' actions, regardless of whether they have been triggered yet or not.

Another minor nitpick, is it possible to sort the values in the 'Advanced Trigger Conditions' dropdown at all? Not sure how they are currently ordered, but feels almost random (eg. I would have expected my custom variable to show up somewhere in alphabetical order; or at the very least not stuck in the middle of the BTT* variables:

yep good point, will sort alphabetically!

1 Like

Sweet, thanks! :slight_smile: