Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 Pass LaunchAgents environment variable to shell #1442

Open
yochem opened this issue Oct 9, 2023 · 1 comment
Open

🐞 Pass LaunchAgents environment variable to shell #1442

yochem opened this issue Oct 9, 2023 · 1 comment
Labels
bug Something isn't working needs refinement This issue is not complete and has to be refined by the maintainers other terminal

Comments

@yochem
Copy link

yochem commented Oct 9, 2023

Description

I have set an environment variable using LaunchAgent (launchctl setenv XDG_CONFIG_HOME /Users/yochem/Library/Config) on startup.

It sets XDG_CONFIG_HOME to a location so my shell (fish in my case) knows its config location.

When I start iTerm2 or vscode, fish loads its config from the correct location (and XDG_CONFIG_HOME has a value). This is not the case with CodeEdit.

To Reproduce

  1. Create the following file:
~/Library/LaunchAgents/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>my.startup</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>
    launchctl setenv XDG_CONFIG_HOME /tmp
    </string>

  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>
  1. $ launchctl load ~/Library/LaunchAgents/environment.plist
  2. Open vscode, its terminal and run $ echo $XDG_CONFIG_HOME

should show an empty line

  1. Open CodeEdit, its terminal and run $ echo $XDG_CONFIG_HOME

should print /tmp

Expected Behavior

I expect that CodeEdit behaves the same as other applications, and is aware of environment variables set via the LaunchAgent. It should pass this environment to the shell.

Version Information

CodeEdit: 0.0.3-alpha.36,5650b45
macOS: 14.0
Xcode: Not installed

Additional Context

No response

Screenshots

VSCode:
image

CodeEdit:
image

@yochem yochem added the bug Something isn't working label Oct 9, 2023
@github-actions github-actions bot added other terminal needs refinement This issue is not complete and has to be refined by the maintainers labels Oct 9, 2023
@yochem
Copy link
Author

yochem commented Oct 9, 2023

This would also help with finding the git configuration at $XDG_CONFIG_HOME/git/config instead of ~/.gitconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs refinement This issue is not complete and has to be refined by the maintainers other terminal
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant