Skip to content

What center-app is expected to do, exactly? #503

Answered by johnlindquist
kenNash asked this question in Q&A
Discussion options

You must be logged in to vote

It is supposed to move the frontmost app to the center of the screen.

"center-app" uses setActiveAppBounds. The implementation of setActiveAppBounds looks like this:

global.setActiveAppBounds = async ({
  left,
  top,
  right,
  bottom,
}) => {
  await applescript(
    `tell application "System Events"
      set processName to name of first application process whose frontmost is true as text
      tell process processName to set the position of front window to {${left}, ${top}}
      tell process processName to set the size of front window to {${
        right - left
      }, ${bottom - top}}
    end tell`
  )
}

Notice the System Events part of the AppleScript. A System Events call will u…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kenNash
Comment options

@kenNash
Comment options

@johnlindquist
Comment options

Answer selected by kenNash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants