9

An application — iA Writer — somehow got stuck off screen with only the corner showing. I can't grab it or use other means to move it from that position.

All new windows open in that position, regardless of if I open/close the application.

Is there a terminal command for moving a specific window's position?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
wintour
  • 193
  • 1
  • 1
  • 4

1 Answers1

10

You can do it with AppleScript:

$ osascript \
    -e 'tell application "Terminal"' \
    -e 'set position of front window to {1, 1}' \
    -e 'end tell'

This isn't guaranteed to work. It's up to the app itself whether it will obey this command. You can try something like set bounds of front window to {1, 1, 800, 600} if it refuses to move the window. That will also resize it, but that might be a good thing, depending on how screwed up the window is.

I've broken the long command up purely for readability. It's fine to give it all as a single line, without the backslashes.

And yes, you need multiple -e options. AppleScript is a line-based language, so each line has to be given separately. You could run osascript without arguments and type the three lines by hand at it instead, if you prefer.

Klesun
  • 105
  • 4
Warren Young
  • 71,107
  • 16
  • 178
  • 168