Search code examples
xcodexcode4tabsbehaviorxcode4.1

Xcode 4.1 behaviours - automate closing a tab?


I have my behaviours set up so that on successfully running a build, Xcode will open a custom debug window. I would like to then close this window when the run completes, however I cannot see an option for this. The best I can manage is returning focus to my main window without closing the debug window.

I have a two monitor setup and most the time use the second monitor for the Xcode organiser. Obviously the debug window is of more use to me when running the application, however I would like to have my organiser back on top afterwards.

Is there any 'Close Tab' behaviour or similar in Xcode 4.1?

Thanks

Update:

Just to say that I've filed a feature request with Apple. Since most of the other behaviours have options (a pop-down menu) to show/hide, it seems only natural that this should be an option for tabs/windows also.


Solution

  • I developed an Xcode plugin (Code on Github) that closes the debug window automatically after the debug session has ended. The plugin was developed and tested with Xcode 4.2.1 but should work with 4.1.

    Usage

    1. Download "Xcode Auto Close Debug"

    2. Unzip it.

    3. Move XcodeAutoCloseDebug.xcplugin to ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/

    4. Restart Xcode

    5. Open menu "Xcode" -> "Preferences" -> "Behaviors" -> "Run Starts".

    6. Activate "Show tab" and set the tab name "XcodeAutoCloseDebug" (this exact name is important!) Setup Screenshot

    7. Run the executable and detach the debugger window (drag the tab out of Xcode to create an own window).

    8. Stop the executable and the window should close automatically.

    ... let me know if you experience any problems.