   statusBarIcon?.setStatus()
   log.debug 'Finished initializing WakaTime.'
 
-settingChangedHandler = (settings) ->
+settingChangedHandler = (settings, initial) ->
   if settings.showStatusBarIcon
     statusBarIcon?.show()
   else

    atom.config.set 'wakatime.apikey', '' # clear setting so it updates in UI
    atom.config.set 'wakatime.apikey', 'Saved in your ~/.wakatime.cfg file'
    saveApiKey apiKey

saveApiKey = (apiKey) ->
  configFile = path.join getUserHome(), '.wakatime.cfg'

  fs.readFile configFile, 'utf-8', (err, configContent) ->
    if err?
      log.debug 'Error: could not read wakatime config file'
      settingChangedHandler atom.config.get('wakatime'), true
      return
    commonConfigs = ini.decode configContent
    if commonConfigs? and commonConfigs.settings? and isValidApiKey(commonConfigs.settings.api_key)
      atom.config.set 'wakatime.apikey', '' # clear setting so it updates in UI
      atom.config.set 'wakatime.apikey', 'Saved in your ~/.wakatime.cfg file'
    else
      settingChangedHandler atom.config.get('wakatime'), true

isValidApiKey = (key) ->
  if not key?
