     treeView.focus()
     @disableHoverEvents() if disableHoverEvents
 
+  # hide the tree view
   hide: (noDelay) ->
     width = atom.config.get 'autohide-tree-view.hiddenWidth'
     transitionDelay = if noDelay then 0 else atom.config.get 'autohide-tree-view.hideDelay'

    @subs.add atom.packages.onDidDeactivatePackage (pkg) ->
      treeView = treeViewEl = null if pkg.path.match /\/tree-view\/?/i

    # following events should be fired AFTER tree-view is done handling them
    @subs.add treeViewEl, 'click', '.entry', (event) =>
      # console.log event.target, event.currentTarget
      if event.currentTarget.classList.contains 'directory'
        @show true
      else
        @hide true
    @subs.add treeViewEl,
      'tree-view:expand-directory': => @show true
      'tree-view:recursive-expand-directory': => @show true
      'tree-view:collapse-directory': => @show true
      'tree-view:recursive-collapse-directory': => @show true
      'tree-view:open-selected-entry': => @hide true
    @subs.add atom.config.observe 'tree-view:showOnRightSide', =>
      @applyHiddenWidth()

  toggleEnabled: ->
    if @enabled
      @disable()
    else
      @enable()

  enable: ->
    treeViewEl.classList.add 'autohide'
    @applyHiddenWidth()

    @hide true
    @enabled = true

  # disable autohide behavior
  disable: ->
    treeViewEl.classList.remove 'autohide'
    treeViewEl.classList.remove 'autohide-hover-events'
