Fattie
Fattie

Reputation: 12336

Xcode, default window layouts?

No-one has been able to answer this question.

It would seem to be impossible to have XCode open this way.

However Youssef provided the most useful answer - so Youssef gets the points, thank you Youssef.


Note for future readers .. the mac utility Moom is excellent for some, but not all, problems of this nature. Again it is not a total solution.


Using the current up-to-date XCode,

Whenever I OPEN a project in XCode (or start a new project),

it looks like this:

enter image description here

However, I want it to look like this:

enter image description here

Again that's when I OPEN a project.

Is there any way to achieve this? Thanks.

Upvotes: 4

Views: 6442

Answers (3)

blub
blub

Reputation: 1014

  1. (not really default layout, you have to hit at least 2 keys simultaneously once XCode is open) You could set up a behavior for "Build->Starts" and hit "CMD + B" after opening XCode / any Project. This way it will 1. change to your Layout even if there are any errors and Build fails and 2. you don't have to Stop it again.

    As already said, it's not a default layout, but I like to let the compiler run through projects of other people at the beginning anyway.

    XCode Preferences


  2. You could search for some Keys in XCodes preference file in ~/Library/Preferences/com.apple.Xcode.plist as already suggested in my comment, I'm not experienced enough to know which are the right ones, sorry.


  3. Wrap the .xcodeproj File opening in an application. E.g. in no way "clean", but anyway:

    1. Set up an XCode behavior like in option 1
    2. Open Automator, choose Application, drag "open Finder Items" and "run AppleScript" inside. Automator

      on run {input, parameters}
      
      set frontmostAppName to name of (info for (path to frontmost application))
      repeat while frontmostAppName is not "XCode.app"
          set frontmostAppName to name of (info for (path to frontmost application))
          delay 0.5
      end repeat
      try
          tell application "System Events" to keystroke "b" using {command down} --simulates CMD + B
      end try
      return input
      
      end run
      
    3. Insert some applescript like the above and save the Automator application.

    4. RightClick -> getInfo on any .xcodeproj File in Finder/on Desktop, in "open with" select your new Automator app, click add and back in the info panel -> check "Change All"

You can obviously create a new Behavior instead of using Build->starts, assign a different Hotkey in XCode and script e.g. tell application "System Events" to keystroke "i" using {command down, control down, shift down, alt down} , optimize the applescript somehow or do everything via a real cocoa app if you want

Upvotes: 1

Y2theZ
Y2theZ

Reputation: 10412

Go to Xcode (in the top menu bar) --> Preferences...

Switch to the Behaviors tab and modify what you want in the Running section

You'll get something like this: enter image description here

You can choose to show/hide what you need, and specify the default behavior

Cheers

EDIT:

After understanding what you need, I will modify my answer.

There is no way to force XCode to automatically enter a behavior at startup.

The best you can do is to create a custom behavior and give it a keyboard shortcut. And when you start XCode just use the keyboard shortcut to enter the desired behavior.

This is how it is done:

In the behaviors tab (above) click on the + sign at the bottom

tut1

Then enter the desired name of this behavior (Maybe StartupBehavior) tut2

Click on the left button to modify the shortcut key. My preferred shortcut key is Command + ` (the button to the left of the '1' key). This is because it will not override any other command and it is easy to click.

Note: you can specify any shortcut you like and dont be afraid to override one that already exists if you don't use it.

Now you need to configure your behavior the way you like it

Tut4 Close the preference windows.

Now everytime you start XCode just use the shortcut key you specified (Command + ` in my case) to quickly load your behavior

Note:

If you dont like keyboard shortcuts you can also load your behavior by going to Xcode (menu bar) --> Behaviors --> Select your behavior Tut5

That is the quickest way you can achieve what you want. I dont think you will be able to force Xcode to run your behavior automatically on startup.

Hope it helped.

Cheers

Upvotes: 7

justin
justin

Reputation: 104698

Well, you may be able to approach it using preconfigured xcuserstate files nested in your project templates' default workspace directory, but that is going to be a pain to tweak and maintain. I'm not even sure it would work.

I would personally just approach it by using Behaviors.

So:

  • 1) create a Behavior
  • 2) Give it a convenient key binding
  • 3) Then define the Behavior. For example:

ASCII Behavior Editor:

...

√ Show *Debugger* with *Console View*

√ *Hide* utilities

...

That should do it. Just hit the assigned key command when you want to restore that display state, regardless of its initial state.

Of course, you can do a few other things or all sorts of arbitrary stuff by running an external AppleScript (triggered with a Behavior's run script facility).

Upvotes: 0

Related Questions