[QESTION] Maximize windows by simulating native MacOS shortcuts (BTT)

Hi,

I prefer having the Green button behaviour in finder act like in Windows (click to maximize and shrink the window). I'm using the script below to achieve that (I found it here in the forum) However that function makes the window jump into maximizing/shrinking very abruptly which I don't really like. I found out that if you option + double click the right corner of the Finder window it maximizes it with the normal animation and then if you option click the green button it shrinks it with the normal animation as well. Is there a way to simulate those two things and have them as the default behaviour of the green button. I think the script I have already in place would be able to do it, but I don't know how to tell it "option + double click the right corner "

async function cycleThrough(triggers) {
  let cycleName = "cycle-" + triggers.join('-'); // Build a unique counter name
  let counterValue = await callBTT('get_number_variable', {variable_name: cycleName});

  // Initialize the value in BTT
  if(counterValue === undefined) {
	await callBTT('set_number_variable', {variable_name: cycleName, to: 0});
	counterValue = 0;
  }

  // Cycle through them
  let modCounter = counterValue % triggers.length;
  callBTT('trigger_named_async_without_response', {trigger_name: triggers[modCounter]});

  // Increment the counter
  await callBTT('set_number_variable', {variable_name: cycleName, to: modCounter+1});

  // return to BTT
  returnToBTT(counterValue);

}

// Cycle through the given triggers
cycleThrough([
  "winmax",
  "winres"
]);

Maximizing will work, however because BTT then overrides the green button, option clicking will not work anymore to restore the previous size.

Thank you! Any way for the BTT to check if a window is maximized (let's say all 4 corners are in extreme positions) and then perform the "restore " action

I just got an idea to make the same thing you described but double click in the top center part of the window, however the "Move mouse" action doesn't have center top as a default option. If it was possible you can make the two action (yours and this) and make them go one after another with a javascript