That’s easier than I thought it would be. Sorry that I need so much hand-holding…I’m a visual learner and an inexperienced programmer. I’m starting to wrap my head around the stack of values in Reverse Polish Notation.
I’ve also realized that this gets even easier if I use tap_state to activate/deactive the layer, because then it’s not necessary to check the previous input state. This enables me to use the hold state as a middle click without needing to add that to the expression.
5 recall
5 recall /* layer active and... */
0x00090004 tap_state /* button is released after tap */
mul
not mul /* deactivate */
5 recall not /* layer not active and... */
0x00090004 tap_state /* button is released after tap */
mul
bitwise_or /* activate */
5 store
Thanks!