Maximizing window and back to the last size

I'm looking for an option to toggle between the maximum window size and the last size back and forth, with the same touch pattern on the trackpad.
I already created a command to maximize my window, but if I choose the same touch pattern for the last size, I get a menu to choose from. I want it without the menu appearing.

Is this possible?

Is there no one who can help me out?

I had a look but couldn't immediately find any way to do this within the BTT UI.

I think you would have to write a script to do this. You would create two named triggers, one for the Maximise action, one for the Restore action.

Then your gesture trigger would run a script (AppleScript or Javascript). This script would check a BTT variable, eg "windowmax"; if it's 0 or not set, it executes the Maximise named trigger, and then sets windowmax = 1. If it's already 1, it runs the Restore named trigger, and sets windowmax = 0.

It would be nice if BTT supported conditional execution within the UI. A simple way would be for a new Trigger option that checks a BTT variable for a specific value, and only triggers the action(s) if the variable is set to that value.

Then it would be possible to do this via the UI, with no script needed. One would add the "Assign Value To Variable" actions to set the variable, and have the triggers check the value when deciding what to execute.

@Black_Simorgh I noticed that another user asked this a while ago, and there's a forum post with an example script you can use, already written: Cycling through custom areas - #7 by coolwhiff

First of all, thanks for your help.
I created two triggers for maximizing and restoring window sizes, but I have no clue about this script.
I had to look it up to know that it is Javascript. :sweat_smile:
Do I have to modify the script to make it work?

You should only need to change this bit:


Change it to:

  "name of maximize trigger",
  "name of restore trigger"

Obviously put the correct names for your named triggers in those two middle lines.

Then you put the script in an "Run Real Javascript" action, Source Type: Real Javascript. If you scroll up in the thread I linked, you can see a screenshot from Andreas showing the action to use. (Your script will look different to his.)


Wow, thank you very much.
It works like a charm. Now I have one less problem to worry about. :sweat_smile:

1 Like

Glad it works. Thanks to @coolwhiff for writing the script!


Damn, I'm really new to BTT and haven't really got any knowledge on JS, but with the examples from @TheBloke and @coolwhiff I managed to make the window title bar's green button to either maximize or return the original size of the window! Works perfectly. Thanks :slight_smile: