 
   startCodekit: ->
     if atom.config.get('codekit-commands.autoStart')
+      @switchProject(atom.workspace.getActivePaneItem())
       script = 'tell application "CodeKit" to launch'
       applescript.execString(script)
 

    treeView = atom.packages.getLoadedPackage('tree-view');
    treeView = require(treeView.mainModulePath);
    packageObj = treeView.serialize();
    script = "tell application \"CodeKit\" to add project at path \"#{packageObj.selectedPath}\""
    applescript.execString(script)

  switchProject: (newPanel) ->
    if atom.config.get('codekit-commands.autoSwitch')
        if newPanel
          if newPanel.buffer
            if newPanel.buffer.file
              script = "tell application \"CodeKit\" to select project containing path \"#{newPanel.buffer.file.path}\""
              applescript.execString(script)

  pauseProject: ->
    if atom.config.get('codekit-commands.autoPause')

    applescript.execString(script)

  refreshProject: ->
    @switchProject(atom.workspace.getActivePaneItem())
    script = 'tell application \"CodeKit\" to refresh browsers'
    applescript.execString(script)

