         linuxFileManagers = ['xdg-open', 'gnome-open', 'kde-open', 'nautilus']
 
         for fm in linuxFileManagers
-          try
-            exec "which #{fm}", (error, stdout, stderr) ->
-                if error is null and stdout isnt null
-                  result = fm
+          console.log "#{@self} Trying: #{fm}"
+          exec "which #{fm}", (error, stdout, stderr) ->
+            if stdout isnt null
+              result = stdout
 
-          # Did we find anything yet?
-          if fm isnt null
+          if typeof result isnt 'undefined'
+            console.log "#{@self} Save to config: #{fm}"
+            atom.config.set('browse.linuxFileManager', fm);
             return fm
 
         atom.notifications.addWarning("atom-browse", detail: "No supported file manager detected", dismissable: true)

      exec "#{@fileManager} #{configPath}"

  getFileManager: ->
    switch process.platform
      when "darwin"
        return "open"

    # Get parent folder of active file
    editor = atom.workspace.getActivePaneItem()
    file = editor?.buffer.file
    
    if file isnt null
      filePath = path.dirname(file?.path)

      # Open packages folder
      exec "#{@fileManager} #{filePath}"
      return

    atom.notifications.addWarning("atom-browse", detail: "No active file", dismissable: false)

  browseConfig: ->
    configPath = path.dirname(@configFile)
