I can't reproduce your behaviour, if I use your command (with true not tput) then there is a race whether I get TERM=screen or not in the first window but after that I always get TERM=screen-256color in the others. I can check with pgrep and after the first window is created, true is no longer running.
Are you sure you don't have any profile stuff interfering with it later? Can you make sure the command has exited? Commands are always started off and the tmux command is executed whenever the result comes back. Otherwise you couldn't run tmux from inside if-shell/run-shell or #(). What we could do would be have the configuration file parser stop processing any further commands from the configuration file only until the last completes. This would probably be safe, but it might get complicated because the configuration parser would have to be able to suspend itself and resume when the callback completes. On Wed, Jan 27, 2010 at 06:55:48PM -0800, Micah Cowan wrote: > I added the following line in my .tmux.conf: > > if 'test "$(tput colors)" = "256"' 'set -g default-terminal screen-256color' > > (all on one line, in the conf file) > > I tested it, it worked, I'm done. Or so I thought. > > The behavior I actually experience is, to me at least, very very odd. > Sometimes (about 10% of the time, maybe less), it starts right up with > the first window having "screen-256color". Most of the time, though, it > doesn't (I have prompt colors set depending on whether 256-color support > is enabled). Sometimes, if I create a new window, that window will be > correctly set, but most of the time (around 80%?) I can keep spawning > windows for a while, and not see one with the correct setting. > Sometimes, if I sit around for a while, then the next window I open will > get the correct setting. > > Strangely, if I open tmux, and the first window is wrong, spawn a > window, it's wrong too, exit the shell in the new window, then open a > new one again, that new one always has the correct TERM setting, 100% of > the time (so far). Again, I can sit there creating windows sometimes for > a minute without seeing the correct setting, but these specific steps > reliably get TERM set correctly in subsequent windows. > > All this remains true if I replace the shell command with simply "true". > > As I understand it, tmux only sources the .tmux.conf file once, when the > server is first started. Creating new windows shouldn't impact it. I can > only guess that shell commands given to "if-shell" must get forked off, > like in run-shell, and the requested setting is then set asynchronously, > after the command has returned. This still doesn't explain why the > command should take so enormously long to run (most of the time), and > either way, it's extremely counter-intuitive, IMO. Unlike "run-shell", > "if-shell" is likely to be used in the config file to set values that > will likely affect the very first window opened, so it seems worthwhile > to wait upon its output before continuing to process anything. > > -- > Micah J. Cowan > http://micah.cowan.name/ > > ------------------------------------------------------------------------------ > The Planet: dedicated and managed hosting, cloud storage, colocation > Stay online with enterprise data centers and the best network in the business > Choose flexible plans and management services without long-term contracts > Personal 24x7 support from experience hosting pros just a phone call away. > http://p.sf.net/sfu/theplanet-com > _______________________________________________ > tmux-users mailing list > tmux-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/tmux-users ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users