[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



On Mon, Oct 02, 2017 at 01:33:01PM +0300, Reco wrote:
> 	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.

Thank you!

The actual issue in my case is "expressing intent" so that profile
(or bashrc) can do a little environment setup according to my intent
- which intention is bound to various window manager shortcuts.

My prime intentions are (oddly enough - I'm sure it's simply never
been done before), to launch 1, 2, 3, 4, and a dozen, terminals, in
various layouts, and which each start at my desired dir/PWD - yep,
never been done before I'm certain :D

Of course I could "express intent" by writing a value to a file, but
then there'd be a race condition of which terminal reads the file,
before the next terminal starts and gets its (slightly different)
intention from that file, and of course this would all just be
bypassing a Unix standard since about 6 thousand years ago (perhaps
Unix is not -quite- that old).

I'm sure that this use of environment variables is utterly unique and
has simply --never-- been thought of before. Or something :)

Thanks again,


Reply to: