Using one gesture for all your window management

Using the new trigger conditions it becomes easy to use one gesture to do many things. For window snapping this is really cool because you can make a gesture execute different window snapping functions depending of the location of your mouse cursor in any window.

Here is an example which I have been using for the last few days and now I can't work without it anymore :slight_smile: . (Requires macOS 3.864).

You can download the preset here:
three-finger-tap-window-management.bttpreset (22.6 KB)

Or here:
folivora.ai - Great Tools for your Mac!

I'm using a three finger tap to do different things depending on the mouse location:

  • Mouse over left half of hovered window: Snap to the left half of the screen
  • Mouse over right half of hovered window: Snap to the right half of the screen
  • Mouse over top left corner of the window: Snap to the top left quarter
  • Mouse over top middle area of the window: Maximize window
  • Mouse over top right corner of the window: Snap to the top right quarter
  • Mouse over bottom left corner of the window: Snap to the bottom left quarter
  • Mouse over bottom right corner of the window: Snap to the bottom right quarter

Of course this could easily be extended to any other window placement or action.

For this to work like in the video, the window snapping mode must be set to "window under cursor"

Then I have just created multiple three finger tap gestures and added conditions based on the "percent_x_hovered_win_btm_left" (this variables uses the relative position of the cursor in the hovered window, where the origin is the bottom left of the window)

This example shows the conditions for the right half. (Must be on the right 50% of the window, must not be in the top 10% of the window, and must not be in the bottom 10% of the window). The 10% areas are used for the quarter snaps, thus they need to be excluded here.

This example shows the conditions for maximize. To create a sub condition like shown here, hold the option key while pressing the plus button.

Hi is this just for trackpad or can you use it with Magic Mouse?

Can be used with any sort of trigger. I have updated the preset to make it easier to reuse. The configuration is now done with named triggers (configured in the "Automations & Named & Other Triggers" section). To use it with a Magic Mouse trigger just use the "Trigger Named Trigger" action like this ( the name of the trigger is: CursorPositionSnapping)

Updated preset:
three-finger-tap-window-management.bttpreset (22.6 KB)

5 Likes

This is a brilliant preset... and it equally does a terrific job demonstrating the capabilities of the new features.

Overall the improvements you have made in the last year to BTT are stunning.

1 Like

Got it working and this is awesome! Tweaked the sensitivity a bit of tap gestures and it is working like a dream.
A game changer!
A build would be 1/3 and 2/3 of screen though dont know how you would get it to do that
Thanks!

Which area of the window would you like to use for 1/3 / 2/3? That's not hard to add, just need to edit some of the conditions a bit :slight_smile:

2 Likes

Thanks, yes I worked it and amended.
Thanks for this

1 Like

WOW!. This is insane. :star_struck:

I just worked through your tutorial and I can't believe how well this works. I only took the liberty, to switch triggers and went for mouse gestures instead. This feels honestly exactly like what I was missing all these years.
Absolutely amazing. Thank You! :pray: :pray:

CleanShot 2022-12-06 at 22.07.11
(In case someone wants to take a look :slight_smile: )

1 Like

I love this feature, but I think I've found a bug with the variables for the mouse position in the active window.

  1. When I move my mouse down, away from the top left corner of the active window, the variable dist_y_active_win_top_left is a negative value (below 0), decreasing as I continue moving the mouse down. The same goes for dist_y_active_win_top_right, as expected.

  2. When I move my mouse up, away from the botton left corner of the active window, the variable dist_y_active_win_bottom_left is a positive value, increasing as I continue moving the mouse up. The same goes for dist_y_active_win_bottom_right, as expected.

  3. When I move my mouse to the right, away from the top left corner of the active window, the variable dist_x_active_win_top_left is a positive value, increasing as I continue moving the mouse to the right. The same goes for dist_x_active_win_bottom_left, as expected.

  4. When I move my mouse to the left, away from the top right corner of the active window, the variable dist_x_active_win_top_right is a negative value, decreasing as I continue moving the mouse to the left.

Now, here's the suspected bug:

When I move my mouse to the left, away from the bottom right corner of the active window, the variable dist_x_active_win_bottom_right is a positive value, increasing as I continue moving the mouse to the left.

Expected behavior

As in obseved behavior 3, the x axis for the opposing corner should have the same coordinate system:

When I move my mouse to the left, away from the bottom right corner of the active window, the variable dist_x_active_win_bottom_right is a negative value, decreasing as I continue moving the mouse to the left.

Example

To create a trigger that is active only if the cursor is inside the active window, with at least 100 pixels distance to all the window edges, I have to use this condition:

dist_x_active_win_top_left >= 100 AND
dist_y_active_win_top_left <= -100 AND 
dist_x_active_win_top_right <= -100 AND 
dist_y_active_win_top_right <= -100 AND 
dist_x_active_win_bottom_left >= 100 AND
dist_y_active_win_bottom_left >= 100 AND
dist_x_active_win_bottom_right >= 100 AND
dist_y_active_win_bottom_right >= 100

You can see that we have 3 less-than conditions and 5 greater-than conditions. I would expect to have the same number of less-than and greater-than conditions:

dist_x_active_win_top_left >= 100 AND
dist_y_active_win_top_left <= -100 AND 
dist_x_active_win_top_right <= -100 AND 
dist_y_active_win_top_right <= -100 AND 
dist_x_active_win_bottom_left >= 100 AND
dist_y_active_win_bottom_left >= 100 AND
dist_x_active_win_bottom_right <= -100 AND
dist_y_active_win_bottom_right >= 100

Side note

In the advanced conditions editor, the variables for the bottom corners are named differently in the “Other Current State” window (with _btm_) than the variables actually used in the conditions (with _bottom_).

Interestingly, the bug cannot be observed in the “Other Current State” window – the value for dist_x_active_win_btm_right decreases as I move the mouse to the left, away from the bottom right corner, in the same way that dist_x_active_win_top_right increases.

See also

Since this is all quite the brain teaser, I've made a diagram to better understand what's going on:

Here is a preset to reproduce the issue. It maximises the current window if you tap the touchpad with three fingers, when the mouse cursor is hovering over the current window, but not over the edges or corners of the window:

3 finger tap window management.bttpreset (6.3 KB)

It works, because I'm using the advanced condition with the 3 less-than and 5 greater-thans shown above.

You are right, I think that variable was broken. Could you check whether the new alpha I just uploaded works for you? ("Check for alpha version udpates")

this is absolutely brilliant ! thanks for improving the best software i've ever seen

you're the reason why i keep using a mac instead of windows haha, BTT is so amazing

Hi Andreas, thanks for the quick response!

Yup, I can confirm that the issue is fixed:

  • dist_x_active_win_bottom_right is now a negative value that decreases as the mouse moves left, away from the right edge of the window
  • All the _bottom_ variables are named consistently, no more _btm_

Cheers,
Patrick