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

Reply via email to