[dev] [dwm] dynamic environment variables

2012-05-19 Thread Swiatoslaw Gal
I am wondering if it is possible to implement some (synamic) management of
environment variables, so, for example I could change HTTP_PROXY when I hook my
laptop in a new place, and all the processes started from now on would respect
it.  I see some problems, it would work if I start my browser via dmenu, but
not from terminal or tabbed.  It seems that one cannot (easily) modify
/proc/PID/environ.  Sucking window managers do that with dbus which is dirty...

Sincerely,
s.



Re: [dev] [dwm] dynamic environment variables

2012-05-19 Thread Connor Lane Smith
Hey,

On 19 May 2012 17:26, Swiatoslaw Gal  wrote:
> I am wondering if it is possible to implement some (synamic) management of
> environment variables, so, for example I could change HTTP_PROXY when I hook 
> my
> laptop in a new place, and all the processes started from now on would respect
> it.

It wouldn't be a perfect solution, but you could just alter your dwm
cmd functions to call a script which set the environment correctly and
then execs the given command. Of course, this wouldn't work for
processes run from terminals unless you also ran them through this
script. But Unix doesn't have Plan 9's env(3), so solutions are
limited.

cls



Re: [dev] [dwm] dynamic environment variables

2012-05-19 Thread Connor Lane Smith
On 19 May 2012 17:36, Connor Lane Smith  wrote:
> It wouldn't be a perfect solution, but you could just alter your dwm
> cmd functions to call a script which set the environment correctly and
> then execs the given command.

Or, of course, if there are only a small number of applications for
which you want this to be done (i.e., your browser), you could wrap
those applications in such a script, rather than something more
generic.

cls



Re: [dev] [dwm] dynamic environment variables

2012-05-19 Thread Christoph Lohmann
Greetings.

On Sat, 19 May 2012 18:44:16 +0200 Swiatoslaw Gal  
wrote:
> I am wondering if it is possible to implement some (synamic) management of
> environment variables, so, for example I could change HTTP_PROXY when I hook 
> my
> laptop in a new place, and all the processes started from now on would respect
> it.  I see some problems, it would work if I start my browser via dmenu, but
> not from terminal or tabbed.  It seems that one cannot (easily) modify
> /proc/PID/environ.  Sucking window managers do that with dbus which is 
> dirty...

Keep the applications simple, so they can be restarted and recognize the
new environment.


Sincerely,

Christoph Lohmann




Re: [dev] [dwm] dynamic environment variables

2012-05-19 Thread Ethan Grammatikidis
On Sat, 19 May 2012 17:37:53 +0100
Connor Lane Smith  wrote:

> On 19 May 2012 17:36, Connor Lane Smith  wrote:
> > It wouldn't be a perfect solution, but you could just alter your dwm
> > cmd functions to call a script which set the environment correctly and
> > then execs the given command.
> 
> Or, of course, if there are only a small number of applications for
> which you want this to be done (i.e., your browser), you could wrap
> those applications in such a script, rather than something more
> generic.

I do this a lot just for... well, I guess I use little scripts instead
of symlinks. Pretty-much all my large apps are launched by script.