Useful for:
- updating current terminal's shell env proxy settings, or
- wrapping exec in
.desktop
files to inject env proxy settings
GNOME proxy settings should normally get propergated into the shell (bash) environment via gnome-terminal, e.g. http_proxy
and no_proxy
. However:
- I noticed that applications exectuted via
.desktop
entries sometimes don't work. This happens when an app ignores org.gnome.proxy settings but can often use proxy env vars from the shell. - If you're proxy settings change, existing shell processes will still have the old proxy enviroment variables, so this can help refresh them whithout having to create a new shell.
See #2777 for Telegram Desktop. Bascially:
- It's defaults works with
http_proxy
when executed via a shell - It's defaults don't work via the
telegramdesktop.desktop
file
E.g. if avaialbe via $PATH
:
...
Exec=gnome_proxy_to_env.sh Telegram -- %u
...
Sourcing the proxy settings into a current shell (changes current shell's proxy env vars)
$ source gnome_proxy_to_env.sh
$ grep http_proxy
http_proxy=http://localhost:8080
Wrap a command (doesn't change current shell's proxy proxy env vars, only called shell subprocess)
$ ./gnome_proxy_to_env env.sh | grep http_proxy
http_proxy=http://localhost:8080
Hi,
thanks for the script!
I made a small improvement (handling empty fields). Perhaps you want to apply that changes, too.