   @formatters[pattern] = BetterBibTeXFormatter.parse(pattern) unless @formatters[pattern]
   return @formatters[pattern]
 
+Zotero.BetterBibTeX.idleService = Components.classes["@mozilla.org/widget/idleservice;1"].getService(Components.interfaces.nsIIdleService)
+Zotero.BetterBibTeX.idleObserver = observe: (subject, topic, data) ->
+  switch topic
+    when 'idle'
+      Zotero.BetterBibTeX.auto.idle = true
+      Zotero.BetterBibTeX.auto.process('idle')
+
+    when 'back'
+      Zotero.BetterBibTeX.auto.idle = false
+  return
+
 Zotero.BetterBibTeX.init = ->
   @log("Running init: #{@initialized}")
   return if @initialized

  }

  @pref.observer.register()

  for own name, endpoint of @endpoints
    url = "/better-bibtex/#{name}"


  nids = []
  nids.push(Zotero.Notifier.registerObserver(@itemChanged, ['item']))
  nids.push(Zotero.Notifier.registerObserver(@collectionChanged, ['collection']))
  nids.push(Zotero.Notifier.registerObserver(@itemAdded, ['collection-item']))
  window.addEventListener('unload', ((e) -> Zotero.Notifier.unregisterObserver(id) for id in nids), false)

  @idleService.addIdleObserver(@idleObserver, 60)

  uninstaller = {
    onUninstalling: (addon, needsRestart) ->
