I've setup ssh-agent as a systemd service on my Manjaro (following directions from here). Along with the service itself, the SSH_AUTH_SOCK environment variable needs to be set to ${XDG_RUNTIME_DIR}/ssh-agent.socket. The above mentioned directions say to put this in .zshrc or equivalent. This works perfectly fine for most applications, as I primarily use commandline when needing to use ssh-agent.
However, when launching VSCode from dmenu, it does not run .zshrc and thus does not inherit the $SSH_AUTH_SOCK environment variable. Thus to get it to work, I need to set the variable globally. Looking at the arch wiki, the only way to do it (that I can see) is through pam_env. However, this did not work for me; I put
SSH_AUTH_SOCK DEFAULT=${XDG_RUNTIME_DIR}/ssh-agent.socket in /etc/environment, but VSCode's process.env still does not have the variable defined. I also tried with
SSH_AUTH_SOCK DEFAULT=/run/user/1000/ssh-agent.socket and it still didn't set.
Note that this is definitely an environment issue as if I launch VSCode from a shell (when .zshrc is run), it does inherit $SSH_AUTH_SOCK. A very similar issue is reported here, but does not actually have a solution.
$XDG_RUNTIME_DIRvariable? I doubt that will be set when the pam_env file is read. You can also try setting the variable in/etc/environment. Does that help? (should we assume you're using Arch?)DEFAULT=/run/user/1000/ssh-agent.socketand it still didn't set.pam_env.so.