putEnv from Prompt.Input

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

putEnv from Prompt.Input

Eric Mrak
I'm trying to set up a prompt to dynamically change environment variables
(say, http_proxy).

I'm using Prompt.Input (inputPrompt) to query for values such as "VAR=val"
and passing those along to putEnv. The problem is when I start a new
terminal using the standard mod+shift+enter the environment does not have
VAR=val in it.

Is there something I'm missing about how XMonad forks processes and passes
along exported values? The only place putEnv seems to work is main, which
is not dynamic.

updateEnvVar :: String -> X ()
updateEnvVar s = catchIO $ putEnv s

defaultConfig { ... } `additionalKeysP` [
  ("M-e", inputPrompt myPromptConfig "set env" ?+ updateEnvVar)
]

Thanks for any help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20141223/b1aaf6e2/attachment.html>

Reply | Threaded
Open this post in threaded view
|

putEnv from Prompt.Input

Brandon Allbery
On Tue, Dec 23, 2014 at 4:16 PM, Eric Mrak <mail at ericmrak.info> wrote:

> I'm using Prompt.Input (inputPrompt) to query for values such as "VAR=val"
> and passing those along to putEnv. The problem is when I start a new
> terminal using the standard mod+shift+enter the environment does not have
> VAR=val in it.
>

What kind of terminal are you starting? If it's based on a terminal factory
(e.g. urxvtc+urxvtd, or xfce4-terminal, etc.) then it won't get any
environment variables from anything but the invocation that starts the
factory backend.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20141223/76cd5449/attachment.html>

Reply | Threaded
Open this post in threaded view
|

putEnv from Prompt.Input

Eric Mrak
I'm using straight st (when testing this I was using it without tmux or any
other multiplexer). I also tested with xterm and urxvt (no client-daemon)

On Tue, Dec 23, 2014 at 1:31 PM, Brandon Allbery <allbery.b at gmail.com>
wrote:

> On Tue, Dec 23, 2014 at 4:16 PM, Eric Mrak <mail at ericmrak.info> wrote:
>
>> I'm using Prompt.Input (inputPrompt) to query for values such as "VAR=val"
>> and passing those along to putEnv. The problem is when I start a new
>> terminal using the standard mod+shift+enter the environment does not
>> have VAR=val in it.
>>
>
> What kind of terminal are you starting? If it's based on a terminal
> factory (e.g. urxvtc+urxvtd, or xfce4-terminal, etc.) then it won't get any
> environment variables from anything but the invocation that starts the
> factory backend.
>
> --
> brandon s allbery kf8nh                               sine nomine
> associates
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20141223/3424a5e6/attachment.html>

Reply | Threaded
Open this post in threaded view
|

putEnv from Prompt.Input

Brandon Allbery
Can you provide the actual code you're running?

On Tue, Dec 23, 2014 at 4:34 PM, Eric Mrak <mail at ericmrak.info> wrote:

> I'm using straight st (when testing this I was using it without tmux or
> any other multiplexer). I also tested with xterm and urxvt (no
> client-daemon)
>
> On Tue, Dec 23, 2014 at 1:31 PM, Brandon Allbery <allbery.b at gmail.com>
> wrote:
>
>> On Tue, Dec 23, 2014 at 4:16 PM, Eric Mrak <mail at ericmrak.info> wrote:
>>
>>> I'm using Prompt.Input (inputPrompt) to query for values such as "
>>> VAR=val" and passing those along to putEnv. The problem is when I start
>>> a new terminal using the standard mod+shift+enter the environment does
>>> not have VAR=val in it.
>>>
>>
>> What kind of terminal are you starting? If it's based on a terminal
>> factory (e.g. urxvtc+urxvtd, or xfce4-terminal, etc.) then it won't get any
>> environment variables from anything but the invocation that starts the
>> factory backend.
>>
>> --
>> brandon s allbery kf8nh                               sine nomine
>> associates
>> allbery.b at gmail.com
>> ballbery at sinenomine.net
>> unix, openafs, kerberos, infrastructure, xmonad
>> http://sinenomine.net
>>
>
>


--
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20150104/a9171a4e/attachment.html>