Bug with "Trigger only while holding these keys" and JSON updating trigger


I have created an "Other Trigger" to manage URL opened with filter "*" (asterisk), so it takes everything I click (outside of a browser) and manages it. Then, I enabled to only trigger while holding the Option key, so I can selectively open in a certain browser, while holding option.

What I'm trying to achieve is, depending on which app I'm currently in, programmatically enable/disable that requirement to hold the Option key, so I can select to open links, in certain apps, with just a click and managed by BTT. I'm doing that by running the following:

tell application "BetterTouchTool"
	update_trigger "XXX" json "{\"BTTRequiredModifierKeys\" : 0}" -- to disable Option
	update_trigger "XXX" json "{\"BTTRequiredModifierKeys\" : 524288}" -- to enable Option
end tell

The problem is that, after disabling the requirement, the trigger doesn't activate while not holding the key. Even if the UI shows that there are no "ticks" on the required checkboxes for a need to hold a key to activate, the trigger only keeps activating while holding Option; no matter what.

While copying the trigger and taking a look at the json definition, I see that it correctly set to "0" the requirement of holding keys; still won't work. Looks like this:

    "BTTEnabled2" : 1,
    "BTTRequiredModifierKeys" : 0,
    "BTTOrder" : 15,

No matter if I try to check/uncheck in the UI, to force "reset" of the trigger, it will only activate if I have Option pressed.

After going crazy for a while troubleshooting what was going on, I went to the "Old UI". There, I enabled/disabled the requirement to have a key pressed for activation, and after copying and inspecting the json again, I noticed that the BTTRequiredModifierKeys parameter is now gone and the triggers works again as it's supposed to do! It looks like this now:

    "BTTEnabled2" : 1,
    "BTTOrder" : 15,

So, the problem is that, no matter that I set it to 0, that value isn't being respected. I need to go to the old UI each time, toggle the checkboxes for holding keys, make that parameter go away from the json, then it works again.

As a workaround, is there any way to completely remove that parameter while using update_trigger, instead of just updating? That might make this work.

Would you please take a look into this, to see what's going on? Thanks.

EDIT: easy way to reproduce this

  1. Create a new Other Trigger to open all URLs (*) with Firefox/Chrome/Etc. (not the default browser)
  2. Test a link and see it opens in the selected browser
  3. Enable "Hold the Option (or any other) key" in the UI
  4. Test that now the link requires holding that key to open in the defined browser
  5. Disable that requirement to hold the key in the trigger
  6. Check the link again. Now it doesn't open any more in the selected browser (as it should), but still, you need to press that key you chose before, to trigger activation; even though the UI shows that no key is required to be held to activate the trigger!

thanks foe the detailed description , I’ll look into it later today!