BetterTouchTool - Help me to learn math

I am just delving into BTT, and I want to have a keyboard hotkey combination that moves the frontmost window to the center of the screen that it is currently on. The idea was to have the window take up 80% of both height and width and be located centered on the screen, which if my math is correct, should mean that the top left corner should be inset by 10% of the screen’s height/width. That seems right to me, but maybe arithmetic is not my strong suit!

Here is a screen shot of the setup in BTT for custom window placement:

The horizontal position is correct; the vertical is not, with the window positioned just below the menu bar.

I have tried this with the “Take Dock and Menu Bar into account for calculations” box checked and unchecked.

What am I missing?

Thanks.

The computer screen width (in pixels) is 100% so you need 10% of the screen’s width. The app needs to be 80% and then there will be 10% left. The same height wise.

If that’s what you meant then it seems right to me.

I don’t know BTT well enough to say whether your logic is correct. I’d be tempted to play with that 10% and the 80% figures one at a time to see what changes.

When I did this using Keyboard Maestro I found the easiest way was to set the middle of the window equal to the middle of the screen. Maybe BTT can do the same?

It does have centre setting, but I found the problem.

Set the Y position to -10.

I discovered this only by switching to Absolute for the Y position, at which point there is a very-small-font message about using negative numbers to go “down from the origin”.

Thanks for the help.

@jec0047 Unfortunately, that did not work. I don’t understand why, but I suspect it relates to BTT moving the window (eg setting the center of the window to the center of the screen) before resizing it, which then puts the window in the wrong place once it is resized. Not sure of that.

@zkarj You solution worked. I had assumed that BTT used the upper left hand corner of the screen as (0,0) with the x coordinate increasing as you go left to right and y increasing top to bottom, but apparently not so.

Yeah, my initial suspicions were that the origin was perhaps not obvious, but I did not consider negative coordinates until I saw that message.

In school, we learn that positive Y goes up, which this does match, but in all the computer systems I’ve used over the years, the graphics origin can either be at the top or the bottom and usually if at the top, then positive Y goes down. I guess the Mac is different.

2 Likes