Triggers don't work until I switch away/back

Describe the bug
I recently got the game Pony Island. Really fun so far. However you really need a mouse and I only have a trackpad. So I set up triggers for the "Z" and "X" keys to correspond to left and right click, respectively. They work great. However I want to be able to disable those triggers to use the keyboard for typing in game. So I added a touch bar button with the following script:

// /------------------\
// |     Settings     |
// \------------------/
var secret = "..."
var triggers = ["86E79D91-26B8-4819-8980-65BD879623B4", "E1175C2C-C5A6-4BEA-91A0-582A1DE273AA", "86085CD6-5AE1-4C87-BA26-27AF753FC274", "F3074310-DEEF-4D51-B952-19CF185060E0"]
var enableButton = "FBD21FD1-AB8D-4F74-B8EA-7950AF0D691B"
var disableButton = "E3467B82-10F8-4771-B5BF-E95ECA4C998D"

// /------------------\
// |       Code       |
// \------------------/
var sData = secret !== undefined ? {shared_secret: secret} : {}
var btt = Application('BetterTouchTool')

var newState = btt.get_number_variable("PonyIslandMouseKeysEnabled", sData) != 1

function setButtonEnabled(uuid, enabled) {
	btt.update_trigger(uuid, {json: JSON.stringify({BTTEnabled2: enabled}), ...sData})

if (newState) {
	setButtonEnabled(enableButton, false)
} else {
	setButtonEnabled(disableButton, false)

btt.set_persistent_number_variable("PonyIslandMouseKeysEnabled", {to: newState ? 1 : 0, ...sData}) // == "success"

for (var trigger of triggers) {
	btt.update_trigger(trigger, {json: JSON.stringify({BTTEnabled: newState}), ...sData})

if (newState) {
	setButtonEnabled(disableButton, true)
} else {
	setButtonEnabled(enableButton, true)

Everything is working great, only one problem: the triggers don't re-enable until I switch to another app and back. Although this would normally be only a minor inconvenience, there is one major problem: the game runs in full screen and it is impossible to switch to other apps while it is running. Therefore I can only re-enable the triggers by relaunching the app every single time. The bug is that re-enabling the triggers does not take effect until I switch to another app and back (which requires relaunching this game), but I would expect that re-enabling the triggers takes effect immediately.

Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
MacBook keyboard + touch bar


Device information:

  • Type of Mac: MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports)
  • macOS version: macOS Mojave 10.14.4 (18E226)
  • BetterTouchTool version: 2.800 (Setapp)

Additional information (e.g. StackTraces, related issues, screenshots, workarounds, etc.):

Note: Before bug reporting, please make sure you have the latest version of BetterTouchTool and that you have already tried to restart your system :-). If you encounter a crash, please attach a crash log from the macOS from the "User Diagnostic Reports" section.