     , constants.PAIRING_CODE_TIME_EXPIRATION
     console.log()
     console.log("Ready to receive data!")
+    start_watching_apps()
     startListening()
     process.nextTick done
 ], (err) ->

        ]
        current_app = opened_apps.get_apps [], unfiltered_tab
        if not Object.keys(current_app).length
          # TODO: Change the current app to UNKNOWN
          return
        else
          # TODO: Update the current app to current_app
          debug "Got the new current app as: " + Object.keys(current_app)[0]
          return
    else
      current_app = opened_apps.get_apps [stdout], []
      if not Object.keys(current_app).length
        # TODO: Change the current app to UNKNOWN
        return
      else
        # TODO: Update the current app to current_app
        debug "Got the new current app as: " + Object.keys(current_app)[0]
        return

setInterval(() ->
  child_process.execFile script_directory + "get_all_windows.sh", (err, stdout, stderr) ->
    if err?
      debug("Error getting all windows #{JSON.stringify err}")
    unfiltered_window_list = parse_windows_list(stdout)
    if "Google Chrome" in unfiltered_window_list
      child_process.execFile script_directory + "get_all_chrome_tabs.sh", (err, stdout, stderr) ->
        if err?
          debug("Error getting chrome tabs")
        unfiltered_chrome_tab_info = parse_chrome_tab_info(stdout)
        args = opened_apps.get_apps(unfiltered_window_list, unfiltered_chrome_tab_info)
        debug args
        get_current_windows()
    else
      args = opened_apps.get_apps(unfiltered_window_list, [])
      debug args
      get_current_windows()
1000)

    client.runScript(snapshot.val())
    ref.child(snapshot.name()).set(null)

  @context_ref = firebaseManager.contextRef(session)
  @context_ref.on 'child_changed', (snapshot, prevChild) ->
    if snapshot.name() != 'current_app'
      return
    @context_ref.child('running_apps').once 'value', (apps) ->
      current_app = snapshot.val()
      if current_app == 'UNKNOWN'
        return
      all_apps = apps.val()
      if all_apps[current_app] != 1
        open_chrome_tab(all_apps[current_app].window_index, all_apps[current_app].tab_index)
      else
        # TODO: Make sure this works for all of our native apps (aka keynote)
        open_window(current_app)

startMediaKeyWatcher = () ->
  # Start the media key watcher
  media_watcher_file = __dirname + "/client/scripts/media/send_media_key.py"
