Web lists-archives.com

Re: SOLVED - Re: xfce4-terminal fails to “pass through” environment variables




	Hi.

On Mon, Oct 02, 2017 at 08:11:14PM +1100, Zenaan Harkness wrote:
> On Mon, Oct 02, 2017 at 10:19:44AM +0300, Reco wrote:
> > 	Hi.
> > 
> > On Mon, Oct 02, 2017 at 02:58:59PM +1100, Zenaan Harkness wrote:
> > > >From terminal A (may be xterm or xfce4-terminal), launch terminals:
> > > 
> > >  MYVAR="wow - some text!" xterm &
> > >  MYVAR="wow - some text!" xfce4-terminal &
> > > 
> > > Now from those terminals, run:
> > > 
> > >  echo $MYVAR
> > > 
> > > 
> > > In xterm, we get the expected output - evidently MYVAR is correctly
> > > "passed through" - this is how env vars should work of course :)
> > > 
> > > But sadly :( , as in, very sadly  :,( , xfce4-terminal does not
> > > produce the expected output - MYVAR is not “passed through” it seems.
> > > 
> > > Does anyone know why, but more importantly, does anyone know how to
> > > overcome this ‘feature’ of xfce4-terminal?
> > 
> > Try this:
> > 
> > MYVAR="wow - some text!" xfce4-terminal --disable-server &
> > 
> > Reco
> 
> Oh, oh, oh‼ I'm hopping excited now, it works it works! :D
> 
> Thanks guys - the fancy arg dancing allows for me to do some fancy
> arg dancing :)

For the archives.

--disable-server removes xfce4-terminal ability to talk to DBUS, which
is intended be used, presumably (too lazy to read sources) to force the
existing xfce4-terminal to spawn a new window.

Without this switch defining new environment variable applies only to
"sending DBUS message" part of xfce4-terminal. And of course such custom
environment variables do not propagate via DBUS.

To do the same trick "terminal emulator - independent way" one needs to
force a terminal to launch a shell with the needed environment variable
defined via env, such as this:

xfce4-terminal --command env MYVAR="wow - some text!" /bin/bash

But that's fugly and probably needs copious amounts of escaping to work
as intended. Disabling DBUS is cleaner, but do not try it with
gnome-terminal, folks.

Reco