Move window to bottom middle, no re-size

Hoping someone can help me with what I hope is a simple ask, and silly oversight by me in not been able to help myself.

I just want to be able to move (not re-size) the current active window so that the window is centred and at the bottom of my monitor.

My main need is to move Infuse, that depending on what content is playing, will have a different window size. Hence my attempts with the custom move/resize aren't reliable (move to bottom left.& change with off-set or move to centre, then move with offset).

Thanks for any help at all, really love this app & community.

You can do that with Javascript:

async function moveWindow() {

  const w = await callBTT("get_number_variable", {
    variable_name: "focused_window_width",
  });
  const h = await callBTT("get_number_variable", {
    variable_name: "focused_window_height",
  });
  const sw = await callBTT("get_number_variable", {
    variable_name: "focused_screen_width",
  });
  const sh = await callBTT("get_number_variable", {
    variable_name: "focused_screen_height",
  });

  let x = sw / 2 - w / 2;
  let y = sh - h;
  
  let actionDefinition = {
      "BTTPredefinedActionType" : 268, 
      "BTTPredefinedActionName": "Save or restore specific window layout",
      "BTTWindowLayout": "[{\"size\":\"{" + w + "," + h + "}\",\"windowName\":\"\/Applications\",\"parentTitle\":\"Finder\",\"position\":\"{" + x + "," + y + "}\",\"role\":\"AXWindow\"}]"
  };
  
  let result = await trigger_action({json: JSON.stringify(actionDefinition), wait_for_reply: false});

  returnToBTT(result);
};

If you change the parentTitle to "Infuse" it should work, no matter what you put in windowName.

(No multimonitor support, for that you need more logic, since the position is global and not local to the screen.)

you can also do it by combining two "custom move resize" actions:

1.) move to center

2.) move to bottom

Wouldn't that put it at the bottom left corner, and not at the bottom center?

no because in the second action the "Really Move" checkbox is not checked for the x axis

(I know I need to make that easier to understand somehow)

So, if none of those checkboxes are set, nothing happens?

correct

Yes. :slight_smile:

Thank you for the efforts in helping @Pal, and for helping to clear up the logic behind the a little more for the move/re-size. I wouldn't have suspected this was the outcome from the UX, but very glad it is.

Appreciate the assist, this is perfect.