wokalski / Distraction-Free-Xcode-plugin

Experience ZEN in Xcode. Distraction free mode, styled after Sublime
MIT License
51 stars 6 forks source link

Run build from Zen mode. #55

Open radekcieciwa opened 8 years ago

radekcieciwa commented 8 years ago

At the moment you cannot build and/or run apps from inside.

It could be a feature request xCode 7.3.1

wokalski commented 8 years ago

In a month or two the vast majority of developers will be using Xcode 8 where plugins like this are very hard to install, and might not work. I am not using Xcode at all at the moment so I have little to no motivation to work on any improvements.

We can live this issue open though, in case anyone wants to solve this.

radekcieciwa commented 8 years ago

I <3 idea of this plugin - so i can work on this feature - 2 month is still a lot to :P

Any tips where to start?

wokalski commented 8 years ago

I'm more than happy to hear that. 🤗🤗🤗

As far as I remember those commands are disabled in the ZEN window (to verify that, you can check move the mouse to the top, click Product and the buttons should be disabled). If this is the case, we need some reverse engineering. Open the xcodeproj and run the plugin. First we need to put some breakpoints to see where the enabling/disabling happens. The method which validates an NSMenuItem is called -validateMenuItem:. This is name of the method for your symbolic breakpoint. Then, add a condition to the breakpoint. I would check if the title of the NSMenuItem is equal to Run or Build. In order to check this, cast $arg2 ($arg1 is self in obj_msgSend) - the first argument - to NSMenuItem and then write the condition.

The result of this experiment will tell you two things about the validation:

  1. "Who" performs it
  2. "Who" responds to it

Now, many things can happen. Probably something (like the windowController) doesn't implement the method, but you will have to check. Also, use Hopper if necessary, but you don't need it at the beginning.

Feel free to get back to me anytime :).