 # These are commands which are bound to keystroke which must be handled by the background page. They are
 # mapped in commands.coffee.
 BackgroundCommands =
-  createTab: (request) ->
+  createTab: repeatCommand (request, callback) ->
     request.url ?= do ->
       url = Settings.get "newTabUrl"
       if url == "pages/blank.html"

    chrome.windows.update(tab.windowId, { focused: true })
    chrome.tabs.update(request.id, { selected: true }))

moveTab = ({count, tab, registryEntry}) ->
  count = -count if registryEntry.command == "moveTabLeft"
  chrome.tabs.getAllInWindow null, (tabs) ->

        if request.tab.incognito then "chrome://newtab" else chrome.runtime.getURL newTabUrl
      else
        url
    TabOperations.openUrlInNewTab request, (tab) -> callback extend request, {tab, tabId: tab.id}
  duplicateTab: repeatCommand (request, callback) ->
    chrome.tabs.duplicate request.tabId, (tab) -> callback extend request, {tab, tabId: tab.id}
  moveTabToNewWindow: ({count, tab}) ->
    chrome.tabs.query {currentWindow: true}, (tabs) ->
      activeTabIndex = tab.index
