             else
                 body.classList.add 'pinned-icons-colorless'
 
+    #
+    observers: ->
+        self = this # This object has to be stored in self because the callback function will create its own 'this'
+        atom.workspace.onDidAddPaneItem (event) ->
+            setTimeout (->
+                r = self.getPaneInformation document.querySelector('.tab-bar .tab.active'), event.index
+                r.pane.moveItem r.item, r.index
+            ), 1
+
 
     # Method to pin the active tab.
     pinActive: ->

        @subscriptions.add atom.commands.add 'atom-workspace', 'pinned-tabs:pin-selected': => @pinSelected()

    # Add an event listener for when the value of the settings are changed.
    setObservers: ->
        body = document.querySelector 'body'
        atom.config.observe 'pinned-tabs.disableTabAnimation', (newValue) ->
            if newValue


    activate: (state) ->
        @setCommands()
        @configObservers()
        @observers()

        # Recover the serialized session or start a new serializable state.
        @PinnedTabsState =
