2

I have a number of bash functions I run at the beginning of each day to start work. They all look pretty much like this:

mind() {
  osascript -e 'tell app "Terminal"
    do script "ssh -A user@my.server.net"
    set bounds of window 1 to {50, 50, 1200, 900}
  end tell'
}

After upgrading to Mavericks, this is mostly working, but it doesn't position the lower-right corner of the window. That is, it positions the top left corner of the new window at 50, 50, but fails to resize the window.

I have reinstalled XQuartz and have it running. How can I get this to resize properly? Did Mavericks change the way bash talks to AppleScript/XQuartz?

4

Try changing the size and position attributes or using System Events instead:

tell application "Terminal"
    tell window 1
        set size to {1150, 850}
        set position to {50, 50}
    end tell
end tell
tell application "System Events" to tell process "Terminal"
    tell window 1
        set size to {1150, 850}
        set position to {50, 50}
    end tell
end tell
2

Lauri's answer almost worked for me, but I had to run the script twice. Setting the position before the size fixed that. It seems you get set a size that would cause the window to leave the screen...

tell application "System Events" to tell process "Terminal"
    tell window 1
        set position to {50, 50}
        set size to {1150, 850}
    end tell
end tell

Also, the first time you run this you should get a message about security, make sure you go into System Prefs -> Security & Privacy -> Privacy -> Accessibility and check "Terminal.app"

0

I temporarily fixed the problem by repeating the set bounds command three times in a row.

  1. The first call moved the window (Terminal in my case) to the right position and gave it the right height but the width was mysteriously equal to the weight.
  2. The second call did enlarge the window but to 1.5 the requested width (eyeballed).
  3. The third call made it just right.

This is slightly different than your problem but close enough that the fix might work. Repeating the command twice might be enough for you.

0

I move my laptop to several desks with external monitors. One one of these, all the positions are now (Mavericks) evaluated relative to "whatever screen the window happens to be one." On others, this is not so.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .