     @listenTo AccountStore, @_onAccountChanged
     @listenTo FocusedMailViewStore, @_onMailViewChanged
 
-    atom.config.observe 'core.workspace.mode', => @_autofocusForLayoutMode()
-
     # We can't create a @view on construction because the CategoryStore
     # has hot yet been populated from the database with the list of
     # categories and their corresponding ids. Once that is ready, the

    task = ArchiveThreadHelper.getArchiveTask([focused])
    @_moveAndShiftBy(offset, task)

  _onMoveThread: (thread, task) ->
    @_moveAndShiftBy('auto', task)

  _onMoveThreads: (threads, task) ->
    selectedThreadIds = threads.map (thread) -> thread.id
    focusedId = FocusedContentStore.focusedId('thread')
    keyboardId = FocusedContentStore.keyboardCursorId('thread')

    TaskQueueStatusStore.waitForPerformLocal(task).then =>
      if focusedId in selectedThreadIds
        Actions.setFocus(collection: 'thread', item: null)
      if keyboardId in selectedThreadIds
        Actions.setCursorPosition(collection: 'thread', item: null)

    Actions.queueTask(task)
    @_view.selection.clear()

  _onArchiveSelection: ->
    selectedThreads = @_view.selection.items()
    task = ArchiveThreadHelper.getArchiveTask(selectedThreads)
    @_onMoveThreads(selectedThreads, task)

  _moveAndShiftBy: (offset, task) ->
    layoutMode = WorkspaceStore.layoutMode()

          for message in messages
            messagesByThread[message.threadId].push message
          messagesByThread

      if WorkspaceStore.layoutMode() is 'split'
          # Set up a one-time listener to focus an item in the new view
        unlisten = view.listen ->
          if view.loaded()
            Actions.setFocus(collection: 'thread', item: view.get(0))
            unlisten()

      @setView(view)

    Actions.setFocus(collection: 'thread', item: null)
