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

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

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

        ]
        current_app = opened_apps.get_apps [], unfiltered_tab
        if not Object.keys(current_app).length
          @context_ref.child('current_app').set('UNKNOWN')
          return
        else
          @context_ref.child('current_app').set(Object.keys(current_app)[0])
          return
    else
      current_app = opened_apps.get_apps [stdout], []
      if not Object.keys(current_app).length
        @context_ref.child('current_app').set('UNKNOWN')
        return
      else
        @context_ref.child('current_app').set(Object.keys(current_app)[0])
        return

start_watching_apps = () ->
  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)
          apps = opened_apps.get_apps(unfiltered_window_list, unfiltered_chrome_tab_info)
          debug apps
          @context_ref.child('running_apps').set(apps)
          get_current_windows()
      else
        apps = opened_apps.get_apps(unfiltered_window_list, [])
        debug apps
        @context_ref.child('running_apps').set(apps)
        get_current_windows()
  1000)
