What center-app is expected to do, exactly? #503
-
Hi everyone! I'm new here, so please forgive my sillinesses… I'm trying the center-app script, but it does nothing for me. I don't even know what to expect, exactly. What does "centering an app" mean? Centering the frontmost window? All of the app windows? I'd like to have scripts for moving/resizing the frontmost window in different places/positions. But so far I can't figure out… Any help would be very much appreciated. -- |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It is supposed to move the frontmost app to the center of the screen. "center-app" uses 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 You can check to see if Kit has access to System Events here: Does that help? |
Beta Was this translation helpful? Give feedback.
It is supposed to move the frontmost app to the center of the screen.
"center-app" uses
setActiveAppBounds
. The implementation ofsetActiveAppBounds
looks like this:Notice the
System Events
part of the AppleScript. ASystem Events
call will u…