Stairways Software Icon

Stairways Software

Excellence In Software For Over Ten Years – Only with a Mac

Scripted window management in Xcode

Matt Gallagher wrote an article on scripted window management in Xcode where he describes the scripts he uses to position windows in Xcode, namely in column 1, column 2, both columns or positioning windows based on type.

I've used this for some time, and it really is a brilliant productivity boost. With a couple keystrokes, I can lay out two windows side by side, or have a window fill the screen so I can concentrate on just one thing. I never used the last option, which, as we will see, is fortunate for me.

Matt accomplishes this using Xcode's User Scripts support, but one thing that always irritated me with this is that it tended to be quite slow the first time you used it. After the first use, it was plenty fast enough, but that first one would take a second or two.

It finally occurred to me that Keyboard Maestro could easily handle this task, so I quickly whipped up the trivial macros and now its lighting fast to move the windows. Because it was so simple, I quickly added three more to position windows on the second monitor.

So, Matt's idea, and two different solutions. What are the pros and cons?

In favor of the AppleScript solution:

  • Positions can be calculated algorithmically based on screen size.
  • Positions can be based on file type.
  • Its free (ie, it doesn't require owning Keyboard Maestro).

In favor of using Keyboard Maestro macros:

  • Much faster on the first use.
  • Much simpler - no scripting.
  • Would work in any application, not just Xcode.

I think this is one of the things I really like about Keyboard Maestro - its not that you can't necessarily do things a different way, its that the solution will generally work across all applications, rather than relying on Xcode's scripting, or BBEdit's text factories, or some other application-specific facility. So once you have learned Keyboard Maestro, you can use it as the tool to accomplish your goal in a variety of different applications.

Posted Tuesday, March 16, 2010. Permalink. Post a Comment.

Comments

Post Comment

Name: (optional)
URL: (optional)
Email: (optional, not published)
   
CAPTCHA: two one two nine (required)
  To prove you are human, please enter the number as digits (ie, 1-9).
Comment:
  You can use some HTML tags such as <b>, <i>, and <a href="">.
We reserve the right to remove any offensive or inappropriate comments.
Due to spam issues, comments are initially invisible until we review them,
you can see them (background red) and we can see them, but no one else.

Comment Preview

None yet.

Buy Now

User Database

Stairways