I don't know too much about tmux internals but I'm going to take a guess
here:
I think the if-shell command is forking and running asynchronously
and tmux is creating the first window before that command returns and sets
the global option.
Simply setting the option (with -g) does work as expected (without the
if-shell)...
So I tried putting the if-shell line at the very top of my tmux.conf.
I tried doing the same thing with both "set-option -g" and simply
"set-option"...
at first it appeared to work, but on retrying it seemed inconsistent.
sometimes the first window gets it,
sometimes it doesn't. a second window usually seems to have it (but not
always...)
I even grep a ps listing to make sure the tmux server is down so that I'm
not getting a cached conf.
I tried putting a "sleep 9;" command in my if-shell and found that my
windows were created as fast as they ever are,
but TERM was set to "screen" (no matter how many windows I created) until 9
seconds had passed.
Then new windows got the new setting.
So it appears that if-shell runs asynchronously even though you may not be
expecting that.
The run-shell command appears to operate the same way.
As a workaround you could put this TERM logic in your bashrc (or rc/profile
for whatever shell you use).
That's where I put it on my pc: I test if the terminfo db supports
screen-256color and then change it.
I could certainly see it being handy to have a synchronous version of (or an
option for) if-shell...
On Sat, May 28, 2011 at 10:38 AM, qwerty asdfg <bollo...@gmail.com> wrote:
> Hello there.
> I am having issues with the if statements
> I have a line in my .tmux.conf like this:
> if '[ -n $DISPLAY ]' 'set -g default-terminal screen-256color'
> But it only works if I open another window,else the terminal is still
> screen..Is there any way to fix this?
>
>
> ------------------------------------------------------------------------------
> vRanger cuts backup time in half-while increasing security.
> With the market-leading solution for virtual backup and recovery,
> you get blazing-fast, flexible, and affordable data protection.
> Download your free trial now.
> http://p.sf.net/sfu/quest-d2dcopy1
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users
>
>
------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery,
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now.
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users