 {CompositeDisposable} = require 'atom'
 
 module.exports = BrowsePackages =
-  browsePackagesView: null
+  self: '[browse]'
   subscriptions: null
   fileManager: null
   configFile: atom.config.getUserConfigPath()

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

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

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

        linuxFileManagers = ['xdg-open', 'gnome-open', 'kde-open', 'nautilus']

        for fm in linuxFileManagers
          console.log "#{@self} Trying: #{fm}"
          exec "which #{fm}", (error, stdout, stderr) ->
            if stdout isnt null
              result = stdout

          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)
