Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Patch Linux Environment When Atom Is Not Launched From A Shell Environment #11910

Closed

Description

@den-is

Atom can't see my environment variables when starting it via GUI (icon in applications menu)

For example there is problem with go-plus package which can't see GOPATH env variable.

Exec Environment:
Fedora 23 x64
Atom : 1.7.4
Electron: 0.36.8
Chrome : 47.0.2526.110
Node : 5.1.1
DE: GNOME Shell 3.18.5
shell: ZeroShell

Here is some outputs from Atoms dev console

  • Starting Atom from Gnome:
process.env['GOPATH']
undefined
process.env['PATH']
"/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/den/.rvm/bin:/home/den/bin"
  • Starting Atom from Terminal
process.env['GOPATH']
"/home/den/projects/gohome"
process.env['PATH']
"/home/den/.autojump/bin:/opt/liteide/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/den/.local/bin:/home/den/bin:/usr/local/go/bin:/home/den/.fzf/bin:/home/den/.rvm/bin"

Haven't found here any topic/issue regarding this.
As we can see there might happen some major problems because of Atom can't see user env variables, locate tools, etc..

Activity

  1. den-is commented on Jun 8, 2016

    @den-is
    Author

    same for
    Atom : 1.8.0

  2. changed the title [-]Linux Environment variables not passed to Atom when started via GUI[/-] [+]Patch Linux Environment When Atom Is Not Launched From A Shell Environment[/+] on Aug 29, 2016
  3. joefitzgerald commented on Aug 29, 2016

    @joefitzgerald
    Contributor

    This is very similar - conceptually - to the issues many users experienced on macOS. When Atom is launched via GUI tools (e.g. the Ubuntu Launcher) it has a different (anaemic) environment relative to the environment available to when Atom is launched from the terminal.

    Many users understand the difference between their terminal environment and their window manager's environment. This is true of both Linux and macOS users. However, a majority of users are unaware of the difference between the environment associated with their terminal and their window manager.

    On macOS, we have decided to patch the environment when a user launched Atom from Finder, Spotlight, or Dock. I have begun exploring the feasibility of doing the same thing for Linux.

    By way of example, the environment for Atom (JSON-ified) when launched from the Ubuntu launcher looks like:

    {
      "ATOM_HOME": "\/home\/vagrant\/.atom",
      "PATH": "\/home\/vagrant\/bin:\/home\/vagrant\/.local\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/usr\/games:\/usr\/local\/games:\/snap\/bin",
      "XDG_VTNR": "7",
      "XDG_SESSION_ID": "c1",
      "CLUTTER_IM_MODULE": "xim",
      "XDG_GREETER_DATA_DIR": "\/var\/lib\/lightdm-data\/vagrant",
      "SHELL": "\/bin\/bash",
      "QT_LINUX_ACCESSIBILITY_ALWAYS_ON": "1",
      "GTK_MODULES": "gail:atk-bridge:unity-gtk-module",
      "USER": "vagrant",
      "QT_ACCESSIBILITY": "1",
      "XDG_SESSION_PATH": "\/org\/freedesktop\/DisplayManager\/Session0",
      "XDG_SEAT_PATH": "\/org\/freedesktop\/DisplayManager\/Seat0",
      "DEFAULTS_PATH": "\/usr\/share\/gconf\/ubuntu.default.path",
      "XDG_CONFIG_DIRS": "\/etc\/xdg\/xdg-ubuntu:\/usr\/share\/upstart\/xdg:\/etc\/xdg",
      "DESKTOP_SESSION": "ubuntu",
      "QT_IM_MODULE": "ibus",
      "QT_QPA_PLATFORMTHEME": "appmenu-qt5",
      "PWD": "\/home\/vagrant",
      "XDG_SESSION_TYPE": "x11",
      "XMODIFIERS": "@im=ibus",
      "LANG": "en_US.UTF-8",
      "MANDATORY_PATH": "\/usr\/share\/gconf\/ubuntu.mandatory.path",
      "GDM_LANG": "en_US",
      "IM_CONFIG_PHASE": "1",
      "COMPIZ_CONFIG_PROFILE": "ubuntu",
      "GDMSESSION": "ubuntu",
      "SESSIONTYPE": "gnome-session",
      "GTK2_MODULES": "overlay-scrollbar",
      "SHLVL": "0",
      "XDG_SEAT": "seat0",
      "HOME": "\/home\/vagrant",
      "LANGUAGE": "en_US:",
      "XDG_SESSION_DESKTOP": "ubuntu",
      "LOGNAME": "vagrant",
      "QT4_IM_MODULE": "xim",
      "XDG_DATA_DIRS": "\/usr\/share\/ubuntu:\/usr\/share\/gnome:\/usr\/local\/share\/:\/usr\/share\/:\/var\/lib\/snapd\/desktop",
      "XDG_RUNTIME_DIR": "\/run\/user\/1000",
      "DISPLAY": ":0",
      "GTK_IM_MODULE": "ibus",
      "XDG_CURRENT_DESKTOP": "Unity",
      "XAUTHORITY": "\/home\/vagrant\/.Xauthority",
      "DBUS_SESSION_BUS_ADDRESS": "unix:abstract=\/tmp\/dbus-5h9PZPCKuc",
      "GNOME_KEYRING_CONTROL": "",
      "SSH_AUTH_SOCK": "\/run\/user\/1000\/keyring\/ssh",
      "GNOME_KEYRING_PID": "",
      "GPG_AGENT_INFO": "\/home\/vagrant\/.gnupg\/S.gpg-agent:0:1",
      "GNOME_DESKTOP_SESSION_ID": "this-is-deprecated",
      "SESSION": "ubuntu",
      "JOB": "unity-settings-daemon",
      "INSTANCE": "",
      "UPSTART_EVENTS": "xsession started",
      "UPSTART_JOB": "unity7",
      "UPSTART_INSTANCE": "",
      "UPSTART_SESSION": "unix:abstract=\/com\/ubuntu\/upstart-session\/1000\/3188",
      "COMPIZ_BIN_PATH": "\/usr\/bin\/",
      "GIO_LAUNCHED_DESKTOP_FILE": "\/usr\/share\/applications\/atom-beta.desktop",
      "GIO_LAUNCHED_DESKTOP_FILE_PID": "7320",
      "GOOGLE_API_KEY": "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q",
      "CHROME_DESKTOP": "Atom.desktop",
      "NODE_PATH": "\/usr\/share\/atom-beta\/resources\/app.asar\/exports",
      "NODE_ENV": "production"
    }

    The environment when launched from the terminal looks like:

    {
      "ATOM_HOME": "\/home\/vagrant\/.atom",
      "XDG_VTNR": "7",
      "XDG_SESSION_ID": "c1",
      "XDG_GREETER_DATA_DIR": "\/var\/lib\/lightdm-data\/vagrant",
      "CLUTTER_IM_MODULE": "xim",
      "SESSION": "ubuntu",
      "GPG_AGENT_INFO": "\/home\/vagrant\/.gnupg\/S.gpg-agent:0:1",
      "VTE_VERSION": "4205",
      "TERM": "xterm-256color",
      "SHELL": "\/bin\/bash",
      "QT_LINUX_ACCESSIBILITY_ALWAYS_ON": "1",
      "WINDOWID": "56623114",
      "GNOME_KEYRING_CONTROL": "",
      "UPSTART_SESSION": "unix:abstract=\/com\/ubuntu\/upstart-session\/1000\/3188",
      "GTK_MODULES": "gail:atk-bridge:unity-gtk-module",
      "USER": "vagrant",
      "QT_ACCESSIBILITY": "1",
      "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",
      "XDG_SESSION_PATH": "\/org\/freedesktop\/DisplayManager\/Session0",
      "XDG_SEAT_PATH": "\/org\/freedesktop\/DisplayManager\/Seat0",
      "SSH_AUTH_SOCK": "\/run\/user\/1000\/keyring\/ssh",
      "DEFAULTS_PATH": "\/usr\/share\/gconf\/ubuntu.default.path",
      "XDG_CONFIG_DIRS": "\/etc\/xdg\/xdg-ubuntu:\/usr\/share\/upstart\/xdg:\/etc\/xdg",
      "DESKTOP_SESSION": "ubuntu",
      "PATH": "\/home\/vagrant\/bin:\/home\/vagrant\/.local\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/usr\/games:\/usr\/local\/games:\/snap\/bin",
      "QT_QPA_PLATFORMTHEME": "appmenu-qt5",
      "QT_IM_MODULE": "ibus",
      "JOB": "unity-settings-daemon",
      "PWD": "\/mnt\/hgfs\/vagrant",
      "XDG_SESSION_TYPE": "x11",
      "XMODIFIERS": "@im=ibus",
      "LANG": "en_US.UTF-8",
      "GNOME_KEYRING_PID": "",
      "MANDATORY_PATH": "\/usr\/share\/gconf\/ubuntu.mandatory.path",
      "GDM_LANG": "en_US",
      "COMPIZ_CONFIG_PROFILE": "ubuntu",
      "IM_CONFIG_PHASE": "1",
      "GDMSESSION": "ubuntu",
      "GTK2_MODULES": "overlay-scrollbar",
      "SESSIONTYPE": "gnome-session",
      "SHLVL": "2",
      "XDG_SEAT": "seat0",
      "HOME": "\/home\/vagrant",
      "LANGUAGE": "en_US:",
      "GNOME_DESKTOP_SESSION_ID": "this-is-deprecated",
      "UPSTART_INSTANCE": "",
      "LOGNAME": "vagrant",
      "XDG_SESSION_DESKTOP": "ubuntu",
      "UPSTART_EVENTS": "xsession started",
      "COMPIZ_BIN_PATH": "\/usr\/bin\/",
      "DBUS_SESSION_BUS_ADDRESS": "unix:abstract=\/tmp\/dbus-5h9PZPCKuc",
      "XDG_DATA_DIRS": "\/usr\/share\/ubuntu:\/usr\/share\/gnome:\/usr\/local\/share\/:\/usr\/share\/:\/var\/lib\/snapd\/desktop",
      "QT4_IM_MODULE": "xim",
      "LESSOPEN": "| \/usr\/bin\/lesspipe %s",
      "UPSTART_JOB": "unity7",
      "INSTANCE": "",
      "DISPLAY": ":0",
      "XDG_RUNTIME_DIR": "\/run\/user\/1000",
      "GTK_IM_MODULE": "ibus",
      "XDG_CURRENT_DESKTOP": "Unity",
      "LESSCLOSE": "\/usr\/bin\/lesspipe %s %s",
      "XAUTHORITY": "\/home\/vagrant\/.Xauthority",
      "_": "\/usr\/bin\/nohup",
      "GOOGLE_API_KEY": "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q",
      "CHROME_DESKTOP": "Atom.desktop",
      "NODE_PATH": "\/usr\/share\/atom-beta\/resources\/app.asar\/exports",
      "NODE_ENV": "production"
    }

    We currently use PWD as the "marker" that someone didn't launch from the terminal on macOS. We would need to find a similar marker using the above keys (i.e, find one that should always be available from a terminal, regardless of the shell in use; that is also not available in the environment when launched from Launcher).

  4. lock commented on Apr 5, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  5. locked and limited conversation to collaborators on Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions