   gp.activate?()
   gp.consumeStatusBar?(gp.statusBar) if gp.statusBar
 
+getWorkspaceNode = -> document.querySelector('atom-workspace')
+
 module.exports =
   config: configurations
 
   subscriptions: null
-
-  workspace: document.querySelector('atom-workspace')
 
   provideService: -> require './service'
 

    @statusBarTile = statusBar.addRightTile item: div, priority: 0

  setupBranchesMenuToggle: (statusBar) ->
    statusBar.getRightTiles().some ({item}) =>
      if item?.classList?.contains? 'git-view'
        $(item).find('.git-branch').on 'click', (e) =>
          {newBranchKey} = atom.config.get('git-plus.general')
          pressed = (key) -> e["#{key}Key"]
          if pressed newBranchKey
            atom.commands.dispatch(@workspace, 'git-plus:new-branch')
          else
            atom.commands.dispatch(@workspace, 'git-plus:checkout')
        return true

  autoFetch: (interval) ->
    clearInterval @autoFetchInterval
    if fetchIntervalMs = (interval * 60) * 1000
      fetch = => atom.commands.dispatch(getWorkspaceNode(), 'git-plus:fetch-all')
      @autoFetchInterval = setInterval(fetch, fetchIntervalMs)

  consumeAutosave: ({dontSaveIf}) ->
